OBJECT Table 550 VAT Rate Change Setup
{
  OBJECT-PROPERTIES
  {
    Date=18.06.20;
    Time=12:00:00;
    Version List=NAVW114.00,MI14.00.00.2.VAT;
  }
  PROPERTIES
  {
    CaptionML=[DEU=Einrichtung der MwSt.-Satznderung;
               ENU=VAT Rate Change Setup];
  }
  FIELDS
  {
    { 1   ;   ;Primary Key         ;Code10        ;CaptionML=[DEU=Primrschlssel;
                                                              ENU=Primary Key] }
    { 10  ;   ;Update Gen. Prod. Post. Groups;Option;
                                                   InitValue=VAT Prod. Posting Group;
                                                   CaptionML=[DEU=Produktbuchungsgruppen aktualisieren;
                                                              ENU=Update Gen. Prod. Post. Groups];
                                                   OptionCaptionML=[DEU=MwSt.-Produktbuchungsgruppe,,,Nein;
                                                                    ENU=VAT Prod. Posting Group,,,No];
                                                   OptionString=VAT Prod. Posting Group,,,No }
    { 15  ;   ;Update G/L Accounts ;Option        ;InitValue=Both;
                                                   CaptionML=[DEU=Sachkonten aktualisieren;
                                                              ENU=Update G/L Accounts];
                                                   OptionCaptionML=[DEU=MwSt.-Produktbuchungsgruppe,Produktbuchungsgruppe,Beides,Nein;
                                                                    ENU=VAT Prod. Posting Group,Gen. Prod. Posting Group,Both,No];
                                                   OptionString=VAT Prod. Posting Group,Gen. Prod. Posting Group,Both,No }
    { 17  ;   ;Update Items        ;Option        ;InitValue=Both;
                                                   AccessByPermission=TableData 27=R;
                                                   CaptionML=[DEU=Artikel aktualisieren;
                                                              ENU=Update Items];
                                                   OptionCaptionML=[DEU=MwSt.-Produktbuchungsgruppe,Produktbuchungsgruppe,Beides,Nein;
                                                                    ENU=VAT Prod. Posting Group,Gen. Prod. Posting Group,Both,No];
                                                   OptionString=VAT Prod. Posting Group,Gen. Prod. Posting Group,Both,No }
    { 18  ;   ;Update Item Templates;Option       ;InitValue=Both;
                                                   AccessByPermission=TableData 27=R;
                                                   CaptionML=[DEU=Artikelvorlagen aktualisieren;
                                                              ENU=Update Item Templates];
                                                   OptionCaptionML=[DEU=MwSt.-Produktbuchungsgruppe,Produktbuchungsgruppe,Beides,Nein;
                                                                    ENU=VAT Prod. Posting Group,Gen. Prod. Posting Group,Both,No];
                                                   OptionString=VAT Prod. Posting Group,Gen. Prod. Posting Group,Both,No }
    { 19  ;   ;Update Item Charges ;Option        ;InitValue=Both;
                                                   AccessByPermission=TableData 5800=R;
                                                   CaptionML=[DEU=Artikel Zu-/Abschlge aktualisieren;
                                                              ENU=Update Item Charges];
                                                   OptionCaptionML=[DEU=MwSt.-Produktbuchungsgruppe,Produktbuchungsgruppe,Beides,Nein;
                                                                    ENU=VAT Prod. Posting Group,Gen. Prod. Posting Group,Both,No];
                                                   OptionString=VAT Prod. Posting Group,Gen. Prod. Posting Group,Both,No }
    { 21  ;   ;Update Resources    ;Option        ;InitValue=Both;
                                                   AccessByPermission=TableData 156=R;
                                                   CaptionML=[DEU=Ressourcen aktualisieren;
                                                              ENU=Update Resources];
                                                   OptionCaptionML=[DEU=MwSt.-Produktbuchungsgruppe,Produktbuchungsgruppe,Beides,Nein;
                                                                    ENU=VAT Prod. Posting Group,Gen. Prod. Posting Group,Both,No];
                                                   OptionString=VAT Prod. Posting Group,Gen. Prod. Posting Group,Both,No }
    { 30  ;   ;Update Gen. Journal Lines;Option   ;InitValue=Both;
                                                   CaptionML=[DEU=Fibu Buch.-Blattzeilen aktualisieren;
                                                              ENU=Update Gen. Journal Lines];
                                                   OptionCaptionML=[DEU=MwSt.-Produktbuchungsgruppe,Produktbuchungsgruppe,Beides,Nein;
                                                                    ENU=VAT Prod. Posting Group,Gen. Prod. Posting Group,Both,No];
                                                   OptionString=VAT Prod. Posting Group,Gen. Prod. Posting Group,Both,No }
    { 31  ;   ;Update Gen. Journal Allocation;Option;
                                                   InitValue=Both;
                                                   AccessByPermission=TableData 221=R;
                                                   CaptionML=[DEU=Fibu Buch.-Blattzuordnung aktualisieren;
                                                              ENU=Update Gen. Journal Allocation];
                                                   OptionCaptionML=[DEU=MwSt.-Produktbuchungsgruppe,Produktbuchungsgruppe,Beides,Nein;
                                                                    ENU=VAT Prod. Posting Group,Gen. Prod. Posting Group,Both,No];
                                                   OptionString=VAT Prod. Posting Group,Gen. Prod. Posting Group,Both,No }
    { 32  ;   ;Update Std. Gen. Jnl. Lines;Option ;InitValue=Both;
                                                   CaptionML=[DEU=Std. Fibu Buch.-Blattzeilen aktualisieren;
                                                              ENU=Update Std. Gen. Jnl. Lines];
                                                   OptionCaptionML=[DEU=MwSt.-Produktbuchungsgruppe,Produktbuchungsgruppe,Beides,Nein;
                                                                    ENU=VAT Prod. Posting Group,Gen. Prod. Posting Group,Both,No];
                                                   OptionString=VAT Prod. Posting Group,Gen. Prod. Posting Group,Both,No }
    { 33  ;   ;Update Res. Journal Lines;Option   ;InitValue=Gen. Prod. Posting Group;
                                                   AccessByPermission=TableData 156=R;
                                                   CaptionML=[DEU=Res. Buch.-Blattzeilen aktualisieren;
                                                              ENU=Update Res. Journal Lines];
                                                   OptionCaptionML=[DEU=,Produktbuchungsgruppe,,Nein;
                                                                    ENU=,Gen. Prod. Posting Group,,No];
                                                   OptionString=,Gen. Prod. Posting Group,,No }
    { 35  ;   ;Update Job Journal Lines;Option    ;InitValue=Gen. Prod. Posting Group;
                                                   AccessByPermission=TableData 167=R;
                                                   CaptionML=[DEU=Projekt Buch.-Blattzeilen aktualisieren;
                                                              ENU=Update Job Journal Lines];
                                                   OptionCaptionML=[DEU=,Produktbuchungsgruppe,,Nein;
                                                                    ENU=,Gen. Prod. Posting Group,,No];
                                                   OptionString=,Gen. Prod. Posting Group,,No }
    { 37  ;   ;Update Requisition Lines;Option    ;InitValue=Gen. Prod. Posting Group;
                                                   AccessByPermission=TableData 244=R;
                                                   CaptionML=[DEU=Bestellvorschlagszeilen aktualisieren;
                                                              ENU=Update Requisition Lines];
                                                   OptionCaptionML=[DEU=,Produktbuchungsgruppe,,Nein;
                                                                    ENU=,Gen. Prod. Posting Group,,No];
                                                   OptionString=,Gen. Prod. Posting Group,,No }
    { 39  ;   ;Update Std. Item Jnl. Lines;Option ;InitValue=Gen. Prod. Posting Group;
                                                   AccessByPermission=TableData 27=R;
                                                   CaptionML=[DEU=Std. Artikel Buch.-Blattzeilen aktualisieren;
                                                              ENU=Update Std. Item Jnl. Lines];
                                                   OptionCaptionML=[DEU=,Produktbuchungsgruppe,,Nein;
                                                                    ENU=,Gen. Prod. Posting Group,,No];
                                                   OptionString=,Gen. Prod. Posting Group,,No }
    { 41  ;   ;Update Service Docs.;Option        ;InitValue=Both;
                                                   AccessByPermission=TableData 5900=R;
                                                   CaptionML=[DEU=Servicebelege aktualisieren;
                                                              ENU=Update Service Docs.];
                                                   OptionCaptionML=[DEU=MwSt.-Produktbuchungsgruppe,Produktbuchungsgruppe,Beides,Nein;
                                                                    ENU=VAT Prod. Posting Group,Gen. Prod. Posting Group,Both,No];
                                                   OptionString=VAT Prod. Posting Group,Gen. Prod. Posting Group,Both,No }
    { 43  ;   ;Update Serv. Price Adj. Detail;Option;
                                                   InitValue=Gen. Prod. Posting Group;
                                                   AccessByPermission=TableData 5900=R;
                                                   CaptionML=[DEU=Details fr Servicepreiskorrektur aktualisieren;
                                                              ENU=Update Serv. Price Adj. Detail];
                                                   OptionCaptionML=[DEU=,Produktbuchungsgruppe,,Nein;
                                                                    ENU=,Gen. Prod. Posting Group,,No];
                                                   OptionString=,Gen. Prod. Posting Group,,No }
    { 50  ;   ;Update Sales Documents;Option      ;InitValue=Both;
                                                   AccessByPermission=TableData 36=R;
                                                   CaptionML=[DEU=Verkaufsbelege aktualisieren;
                                                              ENU=Update Sales Documents];
                                                   OptionCaptionML=[DEU=MwSt.-Produktbuchungsgruppe,Produktbuchungsgruppe,Beides,Nein;
                                                                    ENU=VAT Prod. Posting Group,Gen. Prod. Posting Group,Both,No];
                                                   OptionString=VAT Prod. Posting Group,Gen. Prod. Posting Group,Both,No }
    { 55  ;   ;Update Purchase Documents;Option   ;InitValue=Both;
                                                   AccessByPermission=TableData 38=R;
                                                   CaptionML=[DEU=Einkaufsbelege aktualisieren;
                                                              ENU=Update Purchase Documents];
                                                   OptionCaptionML=[DEU=MwSt.-Produktbuchungsgruppe,Produktbuchungsgruppe,Beides,Nein;
                                                                    ENU=VAT Prod. Posting Group,Gen. Prod. Posting Group,Both,No];
                                                   OptionString=VAT Prod. Posting Group,Gen. Prod. Posting Group,Both,No }
    { 60  ;   ;Update Production Orders;Option    ;InitValue=Gen. Prod. Posting Group;
                                                   AccessByPermission=TableData 5405=R;
                                                   CaptionML=[DEU=Fertigungsauftrge aktualisieren;
                                                              ENU=Update Production Orders];
                                                   OptionCaptionML=[DEU=,Produktbuchungsgruppe,,Nein;
                                                                    ENU=,Gen. Prod. Posting Group,,No];
                                                   OptionString=,Gen. Prod. Posting Group,,No }
    { 62  ;   ;Update Work Centers ;Option        ;InitValue=Gen. Prod. Posting Group;
                                                   AccessByPermission=TableData 99000758=R;
                                                   CaptionML=[DEU=Arbeitsplatzgruppen aktualisieren;
                                                              ENU=Update Work Centers];
                                                   OptionCaptionML=[DEU=,Produktbuchungsgruppe,,Nein;
                                                                    ENU=,Gen. Prod. Posting Group,,No];
                                                   OptionString=,Gen. Prod. Posting Group,,No }
    { 64  ;   ;Update Machine Centers;Option      ;InitValue=Gen. Prod. Posting Group;
                                                   AccessByPermission=TableData 99000758=R;
                                                   CaptionML=[DEU=Arbeitspltze aktualisieren;
                                                              ENU=Update Machine Centers];
                                                   OptionCaptionML=[DEU=,Produktbuchungsgruppe,,Nein;
                                                                    ENU=,Gen. Prod. Posting Group,,No];
                                                   OptionString=,Gen. Prod. Posting Group,,No }
    { 70  ;   ;Update Reminders    ;Option        ;InitValue=VAT Prod. Posting Group;
                                                   AccessByPermission=TableData 36=R;
                                                   CaptionML=[DEU=Mahnungen aktualisieren;
                                                              ENU=Update Reminders];
                                                   OptionCaptionML=[DEU=MwSt.-Produktbuchungsgruppe,,,Nein;
                                                                    ENU=VAT Prod. Posting Group,,,No];
                                                   OptionString=VAT Prod. Posting Group,,,No }
    { 75  ;   ;Update Finance Charge Memos;Option ;InitValue=VAT Prod. Posting Group;
                                                   CaptionML=[DEU=Zinsrechnungen aktualisieren;
                                                              ENU=Update Finance Charge Memos];
                                                   OptionCaptionML=[DEU=MwSt.-Produktbuchungsgruppe,,,Nein;
                                                                    ENU=VAT Prod. Posting Group,,,No];
                                                   OptionString=VAT Prod. Posting Group,,,No }
    { 90  ;   ;VAT Rate Change Tool Completed;Boolean;
                                                   InitValue=No;
                                                   CaptionML=[DEU=Tool zum ndern des MwSt.-Satzes abgeschlossen;
                                                              ENU=VAT Rate Change Tool Completed] }
    { 91  ;   ;Ignore Status on Sales Docs.;Boolean;
                                                   InitValue=Yes;
                                                   CaptionML=[DEU=Status in Verkaufsbelegen ignorieren;
                                                              ENU=Ignore Status on Sales Docs.] }
    { 92  ;   ;Ignore Status on Purch. Docs.;Boolean;
                                                   InitValue=Yes;
                                                   CaptionML=[DEU=Status in Einkaufsbelegen ignorieren;
                                                              ENU=Ignore Status on Purch. Docs.] }
    { 93  ;   ;Perform Conversion  ;Boolean       ;CaptionML=[DEU=Konvertierung durchfhren;
                                                              ENU=Perform Conversion] }
    { 100 ;   ;Item Filter         ;Text250       ;ValidateTableRelation=No;
                                                   TestTableRelation=No;
                                                   CaptionML=[DEU=Artikelfilter;
                                                              ENU=Item Filter] }
    { 101 ;   ;Account Filter      ;Text250       ;ValidateTableRelation=No;
                                                   TestTableRelation=No;
                                                   CaptionML=[DEU=Kontofilter;
                                                              ENU=Account Filter] }
    { 102 ;   ;Resource Filter     ;Text250       ;ValidateTableRelation=No;
                                                   TestTableRelation=No;
                                                   CaptionML=[DEU=Ressourcenfilter;
                                                              ENU=Resource Filter] }
    { 103 ;   ;Ignore Status on Service Docs.;Boolean;
                                                   InitValue=Yes;
                                                   CaptionML=[DEU=Status in Servicebelegen ignorieren.;
                                                              ENU=Ignore Status on Service Docs.] }
    { 5130220;;Update Down Payment ;Option        ;InitValue=VAT Prod. Posting Group;
                                                   CaptionML=[DEU=Anzahlungsbuchhaltung aktualisieren;
                                                              ENU=Update Down Payment];
                                                   OptionCaptionML=[DEU=MwSt.-Produktbuchungsgruppe,,,Nein;
                                                                    ENU=VAT Prod. Posting Group,,,No];
                                                   OptionString=VAT Prod. Posting Group,,,No;
                                                   Description=MEE }
  }
  KEYS
  {
    {    ;Primary Key                             ;Clustered=Yes }
  }
  FIELDGROUPS
  {
  }
  CODE
  {

    [External]
    PROCEDURE LookUpItemFilter@57(VAR Text@1001 : Text[250]) : Boolean;
    VAR
      Item@1000 : Record 27;
      ItemList@1003 : Page 31;
    BEGIN
      ItemList.LOOKUPMODE(TRUE);
      ItemList.SETTABLEVIEW(Item);
      IF ItemList.RUNMODAL = ACTION::LookupOK THEN BEGIN
        ItemList.GETRECORD(Item);
        Text := ItemList.GetSelectionFilter;
        EXIT(TRUE);
      END;
      EXIT(FALSE)
    END;

    [External]
    PROCEDURE LookUpResourceFilter@1(VAR Text@1001 : Text[250]) : Boolean;
    VAR
      Resource@1000 : Record 156;
      ResourceList@1003 : Page 77;
    BEGIN
      ResourceList.LOOKUPMODE(TRUE);
      ResourceList.SETTABLEVIEW(Resource);
      IF ResourceList.RUNMODAL = ACTION::LookupOK THEN BEGIN
        ResourceList.GETRECORD(Resource);
        Text := Resource."No.";
        EXIT(TRUE);
      END;
      EXIT(FALSE)
    END;

    [External]
    PROCEDURE LookUpGLAccountFilter@2(VAR Text@1001 : Text[250]) : Boolean;
    VAR
      GLAccount@1000 : Record 15;
      GLAccountList@1003 : Page 18;
    BEGIN
      GLAccountList.LOOKUPMODE(TRUE);
      GLAccountList.SETTABLEVIEW(GLAccount);
      IF GLAccountList.RUNMODAL = ACTION::LookupOK THEN BEGIN
        GLAccountList.GETRECORD(GLAccount);
        Text := GLAccountList.GetSelectionFilter;
        EXIT(TRUE);
      END;
      EXIT(FALSE)
    END;

    BEGIN
    {
      +--------------------------------------------------------------+
      |                  Copyright MODUS Consult AG                  |
      |                        Engineering                           |
      +--------------------------------------------------------------+
      Module    Date      User     Reference  Description
      MI.VAT    15.06.20  BS                  New Field 5130220 Update Down Payment
    }
    END.
  }
}

OBJECT Codeunit 550 VAT Rate Change Conversion
{
  OBJECT-PROPERTIES
  {
    Date=23.06.20;
    Time=12:00:00;
    Version List=NAVW114.01,VG14.00.VAT,MI14.00.00.2.VAT;
  }
  PROPERTIES
  {
    Permissions=TableData 552=i;
    OnRun=BEGIN
            IF NOT VATRateChangeSetup.GET THEN BEGIN
              VATRateChangeSetup.INIT;
              VATRateChangeSetup.INSERT;
            END;

            Convert;
          END;

  }
  CODE
  {
    VAR
      VATRateChangeSetup@1001 : Record 550;
      VATRateChangeConversion@1000 : Record 551;
      UOMMgt@1020 : Codeunit 5402;
      ProgressWindow@1002 : Dialog;
      Text0001@1003 : TextConst 'DEU="Tabelle wird verarbeitet...   #1#####################################  ";ENU="Progressing Table #1#####################################  "';
      Text0002@1004 : TextConst 'DEU="Datensatz wird verarbeitet... #2############ von #3####################  ";ENU="Progressing Record #2############ of #3####################  "';
      Text0004@1005 : TextConst 'DEU=Die Auftragszeile %1 enthlt einen Einkaufscode vom Typ ''Direktlieferung''. Aktualisieren Sie den Auftrag manuell.;ENU=Order line %1 has a drop shipment purchasing code. Update the order manually.';
      Text0005@1006 : TextConst 'DEU=Die Auftragszeile %1 enthlt einen Einkaufscode vom Typ ''Spezialauftrag''. Aktualisieren Sie den Auftrag manuell.;ENU=Order line %1 has a special order purchasing code. Update the order manually.';
      Text0006@1007 : TextConst 'DEU=Fr den Auftrag ist eine teilweise gelieferte Zeile vorhanden, die mit einem Logistikbeleg verknpft ist. Aktualisieren Sie den Auftrag manuell.;ENU=The order has a partially shipped line with link to a WHSE document. Update the order manually.';
      Text0007@1008 : TextConst 'DEU=Es sind keine Inhalte zum Konvertieren vorhanden. Die Restmenge ist null.;ENU=There is nothing to convert. The outstanding quantity is zero.';
      Text0008@1009 : TextConst 'DEU=Die Tabelle ''%1'' muss einen Posten fr die Kombination der MwSt.-Geschftsbuchungsgruppe ''%2'' und der MwSt.-Produktbuchungsgruppe ''%3'' enthalten.;ENU=There must be an entry in the %1 table for the combination of VAT business posting group %2 and VAT product posting group %3.';
      Text0009@1010 : TextConst 'DEU=Die Konvertierung kann nur ausgefhrt werden, wenn ''%1'' auf ''True'' festgelegt ist.;ENU=Conversion cannot be performed before %1 is set to true.';
      Text0010@1011 : TextConst 'DEU=Die Zeile wurde geliefert.;ENU=The line has been shipped.';
      Text0011@1012 : TextConst 'DEU=Belege mit gebuchter Vorauszahlung mssen manuell konvertiert werden.;ENU=Documents that have posted prepayment must be converted manually.';
      Text0012@1013 : TextConst 'DEU=Die Zeile %1 wurde auf zwei Zeilen aufgeteilt. Die Restmenge befindet sich in der neuen Zeile.;ENU=This line %1 has been split into two lines. The outstanding quantity will be on the new line.';
      Text0013@1014 : TextConst 'DEU=Die Zeile %1 wurde hinzugefgt. Sie enthlt die Restmenge aus der Zeile %2.;ENU=This line %1 has been added. It contains the outstanding quantity from line %2.';
      Text0014@1015 : TextConst 'DEU=Die Auftragszeile %1 vom Typ ''%2'' wurde teilweise geliefert/fakturiert. Aktualisieren Sie den Auftrag manuell.;ENU=The order line %1 of type %2 have been partial Shipped/Invoiced . Update the order manually.';
      Text0015@1016 : TextConst 'DEU=Es wurde keine Konvertierung definiert. Definieren Sie die Konvertierung.;ENU=A defined conversion does not exist. Define the conversion.';
      Text0016@1017 : TextConst 'DEU=Es wurden keine zu konvertierenden Tabellen definiert.;ENU=Defined tables for conversion do not exist.';
      Text0017@1018 : TextConst 'DEU=Die Zeile %1 wird auf zwei Zeilen aufgeteilt. Die Restmenge befindet sich in der neuen Zeile.;ENU=This line %1 will be split into two lines. The outstanding quantity will be on the new line.';
      Text0018@1019 : TextConst 'DEU=Dieses Dokument ist mit einem Montageauftrag verknpft. Sie mssen das Dokument manuell konvertieren.;ENU=This document is linked to an assembly order. You must convert the document manually.';
      MI_VATRateChangeConversion@5130099 : Codeunit 5130127;
      VG_VATRateChangeConversion@5137141 : Codeunit 5022744;

    LOCAL PROCEDURE Convert@2();
    VAR
      GenProductPostingGroup@1001 : Record 251;
      TempGenProductPostingGroup@1000 : TEMPORARY Record 251;
    BEGIN
      VATRateChangeSetup.TESTFIELD("VAT Rate Change Tool Completed",FALSE);
      IF VATRateChangeConversion.ISEMPTY THEN
        ERROR(Text0015);
      IF NOT AreTablesSelected THEN
        ERROR(Text0016);
      TestVATPostingSetup;
      ProgressWindow.OPEN(Text0001 + Text0002);
      WITH VATRateChangeSetup DO BEGIN
        ProgressWindow.UPDATE;
        UpdateTable(
          DATABASE::"Gen. Product Posting Group",
          ConvertVATProdPostGrp("Update Gen. Prod. Post. Groups"),ConvertGenProdPostGrp("Update Gen. Prod. Post. Groups"));
        TempGenProductPostingGroup.DELETEALL;
        IF GenProductPostingGroup.FIND('-') THEN
          REPEAT
            TempGenProductPostingGroup := GenProductPostingGroup;
            TempGenProductPostingGroup.INSERT;
            GenProductPostingGroup."Auto Insert Default" := FALSE;
            GenProductPostingGroup.MODIFY;
          UNTIL GenProductPostingGroup.NEXT = 0;
        UpdateItem;
        UpdateRessouce;
        UpdateGLAccount;
        UpdateServPriceAdjDetail;
        UpdatePurchase;
        UpdateSales;
        UpdateService;
        UpdateTable(
          DATABASE::"Item Template",
          ConvertVATProdPostGrp("Update Item Templates"),ConvertGenProdPostGrp("Update Item Templates"));
        UpdateTable(
          DATABASE::"Item Charge",
          ConvertVATProdPostGrp("Update Item Charges"),ConvertGenProdPostGrp("Update Item Charges"));
        UpdateTable(
          DATABASE::"Gen. Journal Line",
          ConvertVATProdPostGrp("Update Gen. Journal Lines"),ConvertGenProdPostGrp("Update Gen. Journal Lines"));
        UpdateTable(
          DATABASE::"Gen. Jnl. Allocation",
          ConvertVATProdPostGrp("Update Gen. Journal Allocation"),ConvertGenProdPostGrp("Update Gen. Journal Allocation"));
        UpdateTable(
          DATABASE::"Standard General Journal Line",
          ConvertVATProdPostGrp("Update Std. Gen. Jnl. Lines"),ConvertGenProdPostGrp("Update Std. Gen. Jnl. Lines"));
        UpdateTable(
          DATABASE::"Res. Journal Line",
          ConvertVATProdPostGrp("Update Res. Journal Lines"),ConvertGenProdPostGrp("Update Res. Journal Lines"));
        UpdateTable(
          DATABASE::"Job Journal Line",
          ConvertVATProdPostGrp("Update Job Journal Lines"),ConvertGenProdPostGrp("Update Job Journal Lines"));
        UpdateTable(
          DATABASE::"Requisition Line",
          ConvertVATProdPostGrp("Update Requisition Lines"),ConvertGenProdPostGrp("Update Requisition Lines"));
        UpdateTable(
          DATABASE::"Standard Item Journal Line",
          ConvertVATProdPostGrp("Update Std. Item Jnl. Lines"),ConvertGenProdPostGrp("Update Std. Item Jnl. Lines"));
        UpdateTable(
          DATABASE::"Production Order",
          ConvertVATProdPostGrp("Update Production Orders"),ConvertGenProdPostGrp("Update Production Orders"));
        UpdateTable(
          DATABASE::"Work Center",
          ConvertVATProdPostGrp("Update Work Centers"),ConvertGenProdPostGrp("Update Work Centers"));
        UpdateTable(
          DATABASE::"Machine Center",
          ConvertVATProdPostGrp("Update Machine Centers"),ConvertGenProdPostGrp("Update Machine Centers"));
        UpdateTable(
          DATABASE::"Reminder Line",
          ConvertVATProdPostGrp("Update Reminders"),ConvertGenProdPostGrp("Update Reminders"));
        UpdateTable(
          DATABASE::"Finance Charge Memo Line",
          ConvertVATProdPostGrp("Update Finance Charge Memos"),ConvertGenProdPostGrp("Update Finance Charge Memos"));

        // MI Konvertierung
        CODEUNIT.RUN(CODEUNIT::"MI VAT Rate Change Conversion");   // MI.VAT.N 15.06.20 BS

        GenProductPostingGroup.DELETEALL;
        IF TempGenProductPostingGroup.FIND('-') THEN
          REPEAT
            GenProductPostingGroup := TempGenProductPostingGroup;
            GenProductPostingGroup.INSERT;
            TempGenProductPostingGroup.DELETE;
          UNTIL TempGenProductPostingGroup.NEXT = 0;
      END;
      ProgressWindow.CLOSE;
      IF VATRateChangeSetup."Perform Conversion" THEN BEGIN
        VATRateChangeSetup."VAT Rate Change Tool Completed" := TRUE;
        VATRateChangeSetup.MODIFY;
        VATRateChangeConversion.RESET;
        IF VATRateChangeConversion.FINDSET(TRUE) THEN
          REPEAT
            VATRateChangeConversion."Converted Date" := WORKDATE;
            VATRateChangeConversion.MODIFY;
          UNTIL VATRateChangeConversion.NEXT = 0;
      END;
    END;

    LOCAL PROCEDURE TestVATPostingSetup@24();
    VAR
      VATPostingSetupOld@1000 : Record 325;
      VATPostingSetupNew@1001 : Record 325;
      VATRateChangeConversion@1002 : Record 551;
    BEGIN
      VATRateChangeConversion.SETRANGE(Type,VATRateChangeConversion.Type::"VAT Prod. Posting Group");
      IF VATRateChangeConversion.FINDSET THEN
        REPEAT
          VATPostingSetupOld.SETRANGE("VAT Prod. Posting Group",VATRateChangeConversion."From Code");
          IF VATPostingSetupOld.FINDSET THEN
            REPEAT
              IF NOT VATPostingSetupNew.GET(VATPostingSetupOld."VAT Bus. Posting Group",VATRateChangeConversion."To Code") THEN
                ERROR(
                  Text0008,
                  VATPostingSetupNew.TABLECAPTION,
                  VATPostingSetupOld."VAT Bus. Posting Group",
                  VATRateChangeConversion."To Code");
              IF VATPostingSetupOld."VAT Identifier" <> '' THEN
                VATPostingSetupNew.TESTFIELD("VAT Identifier")
            UNTIL VATPostingSetupOld.NEXT = 0;
        UNTIL VATRateChangeConversion.NEXT = 0;
    END;

    LOCAL PROCEDURE UpdateItem@5();
    VAR
      Item@1000 : Record 27;
      RecRef@1001 : RecordRef;
    BEGIN
      ProgressWindow.UPDATE(1,Item.TABLECAPTION);
      WITH VATRateChangeSetup DO
        IF "Item Filter" = '' THEN
          UpdateTable(DATABASE::Item,ConvertVATProdPostGrp("Update Items"),ConvertGenProdPostGrp("Update Items"))
        ELSE BEGIN
          Item.SETFILTER("No.","Item Filter");
          IF Item.FIND('-') THEN
            REPEAT
              RecRef.GETTABLE(Item);
              UpdateRec(RecRef,ConvertVATProdPostGrp("Update Items"),ConvertGenProdPostGrp("Update Items"));
            UNTIL Item.NEXT = 0;
        END;
    END;

    LOCAL PROCEDURE UpdateGLAccount@8();
    VAR
      GLAccount@1000 : Record 15;
      RecRef@1001 : RecordRef;
    BEGIN
      ProgressWindow.UPDATE(1,GLAccount.TABLECAPTION);
      WITH VATRateChangeSetup DO
        IF "Account Filter" = '' THEN
          UpdateTable(DATABASE::"G/L Account",ConvertVATProdPostGrp("Update G/L Accounts"),ConvertGenProdPostGrp("Update G/L Accounts"))
        ELSE BEGIN
          GLAccount.SETFILTER("No.","Account Filter");
          IF GLAccount.FIND('-') THEN
            REPEAT
              RecRef.GETTABLE(GLAccount);
              UpdateRec(RecRef,ConvertVATProdPostGrp("Update G/L Accounts"),ConvertGenProdPostGrp("Update G/L Accounts"));
            UNTIL GLAccount.NEXT = 0;
        END;
    END;

    LOCAL PROCEDURE UpdateRessouce@7();
    VAR
      Resource@1000 : Record 156;
      RecRef@1001 : RecordRef;
    BEGIN
      WITH VATRateChangeSetup DO
        IF "Resource Filter" = '' THEN
          UpdateTable(DATABASE::Resource,ConvertVATProdPostGrp("Update Resources"),ConvertGenProdPostGrp("Update Resources"))
        ELSE BEGIN
          Resource.SETFILTER("No.","Resource Filter");
          IF Resource.FIND('-') THEN
            REPEAT
              RecRef.GETTABLE(Resource);
              UpdateRec(RecRef,ConvertVATProdPostGrp("Update Resources"),ConvertGenProdPostGrp("Update Resources"));
            UNTIL Resource.NEXT = 0;
        END;
    END;

    LOCAL PROCEDURE ConvertVATProdPostGrp@3(UpdateOption@1000 : Option) : Boolean;
    VAR
      DummyVATRateChangeSetup@1001 : Record 550;
    BEGIN
      IF UpdateOption IN [DummyVATRateChangeSetup."Update Items"::"VAT Prod. Posting Group",
                          DummyVATRateChangeSetup."Update Items"::Both]
      THEN
        EXIT(TRUE);
      EXIT(FALSE);
    END;

    LOCAL PROCEDURE ConvertGenProdPostGrp@6(UpdateOption@1000 : Option) : Boolean;
    VAR
      DummyVATRateChangeSetup@1001 : Record 550;
    BEGIN
      IF UpdateOption IN [DummyVATRateChangeSetup."Update Items"::"Gen. Prod. Posting Group",
                          DummyVATRateChangeSetup."Update Items"::Both]
      THEN
        EXIT(TRUE);
      EXIT(FALSE);
    END;

    LOCAL PROCEDURE UpdateTable@4(TableID@1005 : Integer;ConvertVATProdPostingGroup@1000 : Boolean;ConvertGenProdPostingGroup@1001 : Boolean);
    VAR
      RecRef@1004 : RecordRef;
      I@1003 : Integer;
    BEGIN
      IF NOT ConvertVATProdPostingGroup AND NOT ConvertGenProdPostingGroup THEN
        EXIT;
      RecRef.OPEN(TableID);
      ProgressWindow.UPDATE(1,FORMAT(RecRef.CAPTION));
      I := 0;
      ProgressWindow.UPDATE(3,RecRef.COUNT);
      IF RecRef.FIND('-') THEN
        REPEAT
          I := I + 1;
          ProgressWindow.UPDATE(2,I);
          UpdateRec(RecRef,ConvertVATProdPostingGroup,ConvertGenProdPostingGroup);
        UNTIL RecRef.NEXT = 0;
    END;

    LOCAL PROCEDURE UpdateRec@1(VAR RecRef@1005 : RecordRef;ConvertVATProdPostingGroup@1000 : Boolean;ConvertGenProdPostingGroup@1001 : Boolean);
    VAR
      Field@1008 : Record 2000000041;
      VATRateChangeLogEntry@1002 : Record 552;
      FieldRef@1003 : FieldRef;
      GenProdPostingGroupConverted@1004 : Boolean;
      VATProdPostingGroupConverted@1006 : Boolean;
    BEGIN
      VATRateChangeLogEntry.INIT;
      VATRateChangeLogEntry."Record ID" := RecRef.RECORDID;
      VATRateChangeLogEntry."Table ID" := RecRef.NUMBER;
      Field.SETRANGE(TableNo,RecRef.NUMBER);
      Field.SETFILTER(ObsoleteState,'<>%1',Field.ObsoleteState::Removed);
      Field.SETRANGE(RelationTableNo,DATABASE::"Gen. Product Posting Group");
      IF Field.FIND('+') THEN
        REPEAT
          FieldRef := RecRef.FIELD(Field."No.");
          GenProdPostingGroupConverted := FALSE;
          IF ConvertGenProdPostingGroup THEN
            IF VATRateChangeConversion.GET(VATRateChangeConversion.Type::"Gen. Prod. Posting Group",FieldRef.VALUE) THEN BEGIN
              VATRateChangeLogEntry."Old Gen. Prod. Posting Group" := FieldRef.VALUE;
              FieldRef.VALIDATE(VATRateChangeConversion."To Code");
              VATRateChangeLogEntry."New Gen. Prod. Posting Group" := FieldRef.VALUE;
              GenProdPostingGroupConverted := TRUE;
            END;
          IF NOT GenProdPostingGroupConverted THEN BEGIN
            VATRateChangeLogEntry."Old Gen. Prod. Posting Group" := FieldRef.VALUE;
            VATRateChangeLogEntry."New Gen. Prod. Posting Group" := FieldRef.VALUE;
          END;
        UNTIL Field.NEXT(-1) = 0;

      Field.SETRANGE(RelationTableNo,DATABASE::"VAT Product Posting Group");
      IF Field.FIND('+') THEN
        REPEAT
          FieldRef := RecRef.FIELD(Field."No.");
          VATProdPostingGroupConverted := FALSE;
          IF ConvertVATProdPostingGroup THEN
            IF VATRateChangeConversion.GET(VATRateChangeConversion.Type::"VAT Prod. Posting Group",FieldRef.VALUE) THEN BEGIN
              VATRateChangeLogEntry."Old VAT Prod. Posting Group" := FieldRef.VALUE;
              FieldRef.VALIDATE(VATRateChangeConversion."To Code");
              VATRateChangeLogEntry."New VAT Prod. Posting Group" := FieldRef.VALUE;
              VATProdPostingGroupConverted := TRUE;
            END;
          IF NOT VATProdPostingGroupConverted THEN BEGIN
            VATRateChangeLogEntry."Old VAT Prod. Posting Group" := FieldRef.VALUE;
            VATRateChangeLogEntry."New VAT Prod. Posting Group" := FieldRef.VALUE;
          END;
        UNTIL Field.NEXT(-1) = 0;

      IF VATRateChangeSetup."Perform Conversion" THEN BEGIN
        RecRef.MODIFY;
        VATRateChangeLogEntry.Converted := TRUE;
      END;
      IF (VATRateChangeLogEntry."New Gen. Prod. Posting Group" <> VATRateChangeLogEntry."Old Gen. Prod. Posting Group") OR
         (VATRateChangeLogEntry."New VAT Prod. Posting Group" <> VATRateChangeLogEntry."Old VAT Prod. Posting Group")
      THEN
        WriteLogEntry(VATRateChangeLogEntry);
    END;

    LOCAL PROCEDURE WriteLogEntry@10(VATRateChangeLogEntry@1000 : Record 552);
    BEGIN
      WITH VATRateChangeLogEntry DO BEGIN
        IF Converted THEN
          "Converted Date" := WORKDATE
        ELSE
          IF Description = '' THEN
            Description := STRSUBSTNO(Text0009,VATRateChangeSetup.FIELDCAPTION("Perform Conversion"));
        INSERT;
      END;
    END;

    LOCAL PROCEDURE UpdateSales@12();
    VAR
      SalesHeader@1000 : Record 36;
      SalesHeader2@1004 : Record 36;
      SalesLine@1003 : Record 37;
      SalesLineOld@1011 : Record 37;
      VATRateChangeLogEntry@1002 : Record 552;
      RecRef@1001 : RecordRef;
      SalesHeaderStatusChanged@1005 : Boolean;
      NewVATProdPotingGroup@1007 : Code[20];
      NewGenProdPostingGroup@1008 : Code[20];
      ConvertVATProdPostingGroup@1009 : Boolean;
      ConvertGenProdPostingGroup@1006 : Boolean;
      RoundingPrecision@1010 : Decimal;
    BEGIN
      ProgressWindow.UPDATE(1,SalesHeader.TABLECAPTION);
      ConvertVATProdPostingGroup := ConvertVATProdPostGrp(VATRateChangeSetup."Update Sales Documents");
      ConvertGenProdPostingGroup := ConvertGenProdPostGrp(VATRateChangeSetup."Update Sales Documents");
      IF NOT ConvertVATProdPostingGroup AND NOT ConvertGenProdPostingGroup THEN
        EXIT;

      SalesHeader.SETFILTER(
        "Document Type",'%1..%2|%3',SalesHeader."Document Type"::Quote,SalesHeader."Document Type"::Invoice,
        SalesHeader."Document Type"::"Blanket Order");
      IF SalesHeader.FIND('-') THEN
        REPEAT
          SalesHeaderStatusChanged := FALSE;
          IF CanUpdateSales(SalesHeader,ConvertVATProdPostingGroup,ConvertGenProdPostingGroup) THEN BEGIN
            IF VATRateChangeSetup."Ignore Status on Sales Docs." THEN
              IF SalesHeader.Status <> SalesHeader.Status::Open THEN BEGIN
                SalesHeader2 := SalesHeader;
                SalesHeader.Status := SalesHeader.Status::Open;
                SalesHeader.MODIFY;
                SalesHeaderStatusChanged := TRUE;
              END;
            IF SalesHeader.Status = SalesHeader.Status::Open THEN BEGIN
              SalesLine.SETRANGE("Document Type",SalesHeader."Document Type");
              SalesLine.SETRANGE("Document No.",SalesHeader."No.");
              IF SalesLine.FINDSET THEN
                REPEAT
                  IF LineInScope(
                       SalesLine."Gen. Prod. Posting Group",SalesLine."VAT Prod. Posting Group",ConvertGenProdPostingGroup,
                       ConvertVATProdPostingGroup)
                  THEN
                    IF (SalesLine."Shipment No." = '') AND (SalesLine."Return Receipt No." = '') AND
                       IncludeLine(SalesLine.Type,SalesLine."No.")
                    THEN
                      IF SalesLine.Quantity = SalesLine."Outstanding Quantity" THEN BEGIN
                        RecRef.GETTABLE(SalesLine);

                        IF SalesHeader."Prices Including VAT" THEN
                          SalesLineOld := SalesLine;

                        UpdateRec(
                          RecRef,ConvertVATProdPostGrp(VATRateChangeSetup."Update Sales Documents"),
                          ConvertGenProdPostGrp(VATRateChangeSetup."Update Sales Documents"));

                        IF SalesHeader."Prices Including VAT" AND VATRateChangeSetup."Perform Conversion" THEN BEGIN
                          RecRef.SETTABLE(SalesLine);
                          RoundingPrecision := GetRoundingPrecision(SalesHeader."Currency Code");
                          SalesLine.VALIDATE(
                            "Unit Price",
                            ROUND(
                              SalesLineOld."Unit Price" * (100 + SalesLine."VAT %") / (100 + SalesLineOld."VAT %"),RoundingPrecision))
                        END;
                      END ELSE
                        IF VATRateChangeSetup."Perform Conversion" AND (SalesLine."Outstanding Quantity" <> 0) THEN BEGIN
                          NewVATProdPotingGroup := SalesLine."VAT Prod. Posting Group";
                          NewGenProdPostingGroup := SalesLine."Gen. Prod. Posting Group";
                          IF VATRateChangeConversion.GET(
                               VATRateChangeConversion.Type::"VAT Prod. Posting Group",SalesLine."VAT Prod. Posting Group")
                          THEN
                            NewVATProdPotingGroup := VATRateChangeConversion."To Code";
                          IF VATRateChangeConversion.GET(
                               VATRateChangeConversion.Type::"Gen. Prod. Posting Group",SalesLine."Gen. Prod. Posting Group")
                          THEN
                            NewGenProdPostingGroup := VATRateChangeConversion."To Code";
                          AddNewSalesLine(SalesLine,NewVATProdPotingGroup,NewGenProdPostingGroup);
                        END ELSE BEGIN
                          RecRef.GETTABLE(SalesLine);
                          InitVATRateChangeLogEntry(
                            VATRateChangeLogEntry,RecRef,SalesLine."Outstanding Quantity",SalesLine."Line No.");
                          VATRateChangeLogEntry.UpdateGroups(
                            SalesLine."Gen. Prod. Posting Group",SalesLine."Gen. Prod. Posting Group",
                            SalesLine."VAT Prod. Posting Group",SalesLine."VAT Prod. Posting Group");
                          WriteLogEntry(VATRateChangeLogEntry);
                        END;
                UNTIL SalesLine.NEXT = 0;
            END;
            IF SalesHeaderStatusChanged THEN BEGIN
              SalesHeader.Status := SalesHeader2.Status;
              SalesHeader.MODIFY;
            END;
          END;
        UNTIL SalesHeader.NEXT = 0;
    END;

    LOCAL PROCEDURE CanUpdateSales@11(SalesHeader@1007 : Record 36;ConvertVATProdPostingGroup@1005 : Boolean;ConvertGenProdPostingGroup@1004 : Boolean) : Boolean;
    VAR
      SalesLine@1003 : Record 37;
      VATRateChangeLogEntry@1002 : Record 552;
      WhseValidateSourceLine@1000 : Codeunit 5777;
      RecRef@1001 : RecordRef;
      DescriptionTxt@1006 : Text[250];
    BEGIN
      WITH SalesLine DO BEGIN
        SETRANGE("Document Type",SalesHeader."Document Type");
        SETRANGE("Document No.",SalesHeader."No.");
        IF FINDSET THEN
          REPEAT
            DescriptionTxt := '';

            IF LineInScope("Gen. Prod. Posting Group","VAT Prod. Posting Group",ConvertGenProdPostingGroup,ConvertVATProdPostingGroup) THEN BEGIN

              DescriptionTxt := MI_VATRateChangeConversion.CheckSalesLine(SalesLine); // MI.VAT.N 17.06.20

              IF ("Outstanding Quantity" <> Quantity) AND ("Outstanding Quantity" <> 0) THEN BEGIN //MF/VG.N 17.06.20 TB Prfungen fr protokoll
                VG_VATRateChangeConversion.CheckSalesLine(SalesHeader,SalesLine,DescriptionTxt);//VG.N 17.06.20 TB Prfungen fr protokoll
              END;//MF/VG.N 17.06.20 TB Prfungen fr protokoll
              IF "Drop Shipment" AND ("Purchase Order No." <> '') THEN
                DescriptionTxt := STRSUBSTNO(Text0004,"Line No.");
              IF "Special Order" AND ("Special Order Purchase No." <> '') THEN
                DescriptionTxt := STRSUBSTNO(Text0005,"Line No.");
              IF ("Outstanding Quantity" <> Quantity) AND
                 WhseValidateSourceLine.WhseLinesExist(DATABASE::"Sales Line","Document Type","Document No.","Line No.",0,Quantity)
              THEN
                DescriptionTxt := Text0006;
              IF ("Outstanding Quantity" <> Quantity) AND (Type = Type::"Charge (Item)") THEN
                DescriptionTxt := STRSUBSTNO(Text0014,"Line No.",Type::"Charge (Item)");
              IF  "Prepmt. Amount Inv. Incl. VAT" <> 0 THEN
                DescriptionTxt := Text0011;
              IF "Qty. to Assemble to Order" <> 0 THEN
                DescriptionTxt := Text0018;

            END;
          UNTIL (NEXT = 0) OR (DescriptionTxt <> '');
      END;
      IF DescriptionTxt = '' THEN
        EXIT(TRUE);

      RecRef.GETTABLE(SalesHeader);
      VATRateChangeLogEntry.INIT;
      VATRateChangeLogEntry."Record ID" := RecRef.RECORDID;
      VATRateChangeLogEntry."Table ID" := RecRef.NUMBER;
      VATRateChangeLogEntry.Description := DescriptionTxt;
      WriteLogEntry(VATRateChangeLogEntry);
    END;

    LOCAL PROCEDURE AddNewSalesLine@1000(SalesLine@1022 : Record 37;VATProdPostingGroup@1001 : Code[20];GenProdPostingGroup@1002 : Code[20]);
    VAR
      NewSalesLine@1004 : Record 37;
      OldSalesLine@1005 : Record 37;
      SalesHeader@1006 : Record 36;
      OldReservationEntry@1009 : Record 337;
      NewReservationEntry@1010 : Record 337;
      OldItemChargeAssignmentSales@1011 : Record 5809;
      NewItemChargeAssignmentSales@1012 : Record 5809;
      VATRateChangeLogEntry@1003 : Record 552;
      RecRef@1000 : RecordRef;
      NewLineNo@1015 : Integer;
      QtyRemainder@1016 : Decimal;
      AmountRemainder@1017 : Decimal;
      RoundingPrecision@1018 : Decimal;
      MI_existingOrderEntryDateL@5130100 : Date;
      MI_existingOrderEntryTimeL@5130101 : Time;
      MI_existingOrderEntryUserL@5130102 : Code[50];
    BEGIN
      IF NOT GetNextSalesLineNo(SalesLine,NewLineNo) THEN
        EXIT;

      // save values from old OrderEntry
      MI_VATRateChangeConversion.SaveExistingOrderEntryValues(SalesLine,MI_existingOrderEntryDateL,MI_existingOrderEntryTimeL,MI_existingOrderEntryUserL);

      WITH NewSalesLine DO BEGIN
        INIT;
        NewSalesLine := SalesLine;
        "Line No." := NewLineNo;
        "Quantity Shipped" := 0;
        "Qty. Shipped (Base)" := 0;
        "Return Qty. Received" := 0;
        "Return Qty. Received (Base)" := 0;
        "Quantity Invoiced" := 0;
        "Qty. Invoiced (Base)" := 0;
        "Reserved Quantity" := 0;
        "Reserved Qty. (Base)" := 0;
        "Qty. to Ship" := 0;
        "Qty. to Ship (Base)" := 0;
        "Return Qty. to Receive" := 0;
        "Return Qty. to Receive (Base)" := 0;
        "Qty. to Invoice" := 0;
        "Qty. to Invoice (Base)" := 0;
        "Qty. Shipped Not Invoiced" := 0;
        "Return Qty. Rcd. Not Invd." := 0;
        "Shipped Not Invoiced" := 0;
        "Return Rcd. Not Invd." := 0;
        "Qty. Shipped Not Invd. (Base)" := 0;
        "Ret. Qty. Rcd. Not Invd.(Base)" := 0;
        "Shipped Not Invoiced (LCY)" := 0;
        "Return Rcd. Not Invd. (LCY)" := 0;
        IF (GenProdPostingGroup <> '') AND ConvertGenProdPostGrp(VATRateChangeSetup."Update Sales Documents") THEN
          VALIDATE("Gen. Prod. Posting Group",GenProdPostingGroup);
        IF (VATProdPostingGroup <> '') AND ConvertVATProdPostGrp(VATRateChangeSetup."Update Sales Documents") THEN
          VALIDATE("VAT Prod. Posting Group",VATProdPostingGroup);
        VALIDATE(Quantity,SalesLine."Outstanding Quantity");
        VALIDATE("Qty. to Ship",SalesLine."Qty. to Ship");
        VALIDATE("Return Qty. to Receive",SalesLine."Return Qty. to Receive");
        IF ABS(SalesLine."Qty. to Invoice") > (ABS(SalesLine."Quantity Shipped") - ABS(SalesLine."Quantity Invoiced")) THEN
          VALIDATE(
            "Qty. to Invoice",SalesLine."Qty. to Invoice" - (SalesLine."Quantity Shipped" - SalesLine."Quantity Invoiced"))
        ELSE
          VALIDATE("Qty. to Invoice",0);
        SalesHeader.GET("Document Type","Document No.");
        RoundingPrecision := GetRoundingPrecision(SalesHeader."Currency Code");
        IF SalesHeader."Prices Including VAT" THEN
          VALIDATE("Unit Price",ROUND(SalesLine."Unit Price" * (100 + "VAT %") / (100 + SalesLine."VAT %"),RoundingPrecision))
        ELSE
          VALIDATE("Unit Price",SalesLine."Unit Price");
        VALIDATE("Line Discount %",SalesLine."Line Discount %");
        INSERT;


        RecRef.GETTABLE(SalesLine);
        VATRateChangeLogEntry.INIT;
        VATRateChangeLogEntry."Record ID" := RecRef.RECORDID;
        VATRateChangeLogEntry."Table ID" := RecRef.NUMBER;
        VATRateChangeLogEntry.UpdateGroups(
          SalesLine."Gen. Prod. Posting Group",SalesLine."Gen. Prod. Posting Group",
          SalesLine."VAT Prod. Posting Group",SalesLine."VAT Prod. Posting Group");
        VATRateChangeLogEntry.Description := STRSUBSTNO(Text0012,FORMAT(SalesLine."Line No."));
        VATRateChangeLogEntry.Converted := TRUE;
        WriteLogEntry(VATRateChangeLogEntry);

        RecRef.GETTABLE(NewSalesLine);
        VATRateChangeLogEntry.INIT;
        VATRateChangeLogEntry."Record ID" := RecRef.RECORDID;
        VATRateChangeLogEntry."Table ID" := RecRef.NUMBER;
        VATRateChangeLogEntry.UpdateGroups(
          SalesLine."Gen. Prod. Posting Group","Gen. Prod. Posting Group",
          SalesLine."VAT Prod. Posting Group","VAT Prod. Posting Group");
        VATRateChangeLogEntry.Description := STRSUBSTNO(Text0013,FORMAT("Line No."),FORMAT(SalesLine."Line No."));
        VATRateChangeLogEntry.Converted := TRUE;
        WriteLogEntry(VATRateChangeLogEntry);
      END;

      UpdateSalesBlanketOrder(NewSalesLine,SalesLine."Line No.");

      OldReservationEntry.RESET;
      OldReservationEntry.SETCURRENTKEY("Source ID","Source Ref. No.","Source Type","Source Subtype");
      OldReservationEntry.SETRANGE("Source ID",SalesLine."Document No.");
      OldReservationEntry.SETRANGE("Source Ref. No.",SalesLine."Line No.");
      OldReservationEntry.SETRANGE("Source Type",DATABASE::"Sales Line");
      OldReservationEntry.SETRANGE("Source Subtype",SalesLine."Document Type");
      OldReservationEntry.SETFILTER(
        "Reservation Status",'%1|%2',OldReservationEntry."Reservation Status"::Reservation,
        OldReservationEntry."Reservation Status"::Surplus);
      IF OldReservationEntry.FINDSET THEN
        REPEAT
          NewReservationEntry := OldReservationEntry;
          NewReservationEntry."Source Ref. No." := NewLineNo;
          NewReservationEntry.MODIFY;
        UNTIL OldReservationEntry.NEXT = 0;

      CASE SalesLine.Type OF
        SalesLine.Type::Item:
          BEGIN
            OldItemChargeAssignmentSales.RESET;
            OldItemChargeAssignmentSales.SETCURRENTKEY("Applies-to Doc. Type","Applies-to Doc. No.","Applies-to Doc. Line No.");
            OldItemChargeAssignmentSales.SETRANGE("Applies-to Doc. Type",SalesLine."Document Type");
            OldItemChargeAssignmentSales.SETRANGE("Applies-to Doc. No.",SalesLine."Document No.");
            OldItemChargeAssignmentSales.SETRANGE("Applies-to Doc. Line No.",SalesLine."Line No.");
            IF OldItemChargeAssignmentSales.FIND('-') THEN
              REPEAT
                QtyRemainder := OldItemChargeAssignmentSales."Qty. to Assign";
                AmountRemainder := OldItemChargeAssignmentSales."Amount to Assign";
                NewItemChargeAssignmentSales := OldItemChargeAssignmentSales;
                NewItemChargeAssignmentSales."Line No." := GetNextItemChrgAssSaleLineNo(OldItemChargeAssignmentSales);
                NewItemChargeAssignmentSales."Applies-to Doc. Line No." := NewLineNo;
                NewItemChargeAssignmentSales."Qty. to Assign" :=
                  ROUND(QtyRemainder / SalesLine.Quantity * SalesLine."Outstanding Quantity",UOMMgt.QtyRndPrecision);
                IF SalesLine."Quantity Shipped" - SalesLine."Quantity Invoiced" = 0 THEN
                  NewItemChargeAssignmentSales."Qty. to Assign" := QtyRemainder;
                NewItemChargeAssignmentSales."Amount to Assign" :=
                  ROUND(NewItemChargeAssignmentSales."Qty. to Assign" * NewItemChargeAssignmentSales."Unit Cost",RoundingPrecision);
                NewItemChargeAssignmentSales.INSERT;
                QtyRemainder := QtyRemainder - NewItemChargeAssignmentSales."Qty. to Assign";
                AmountRemainder := AmountRemainder - NewItemChargeAssignmentSales."Amount to Assign";
                OldItemChargeAssignmentSales."Qty. to Assign" := QtyRemainder;
                OldItemChargeAssignmentSales."Amount to Assign" := AmountRemainder;
                OldItemChargeAssignmentSales.MODIFY;
              UNTIL OldItemChargeAssignmentSales.NEXT = 0;
          END;
      END;

      OldSalesLine.GET(SalesLine."Document Type",SalesLine."Document No.",SalesLine."Line No.");
      OldSalesLine.VALIDATE(Quantity,SalesLine."Quantity Shipped");

      OldSalesLine.VALIDATE("Unit Price",SalesLine."Unit Price");
      OldSalesLine.VALIDATE("Line Discount %",SalesLine."Line Discount %");
      OldSalesLine.VALIDATE("Qty. to Ship",0);
      OldSalesLine.VALIDATE("Return Qty. to Receive",0);
      IF ABS(SalesLine."Qty. to Invoice") > (ABS(SalesLine."Quantity Shipped") - ABS(SalesLine."Quantity Invoiced")) THEN
        OldSalesLine.VALIDATE("Qty. to Invoice",SalesLine."Quantity Shipped" - SalesLine."Quantity Invoiced")
      ELSE
        OldSalesLine.VALIDATE("Qty. to Invoice",SalesLine."Qty. to Invoice");

      OldSalesLine.MODIFY;

      //CopyTexte
      MI_VATRateChangeConversion.CopySalesExtTextAndEditor(OldSalesLine, NewSalesLine); // MI.VAT.N 17.06.20

      //fix orderEntries
      MI_VATRateChangeConversion.UpdateExistingOrderEntriesWithSavedValues(OldSalesLine,NewSalesLine,MI_existingOrderEntryDateL,MI_existingOrderEntryTimeL,MI_existingOrderEntryUserL);
    END;

    LOCAL PROCEDURE UpdateSalesBlanketOrder@20(SalesLine@1000 : Record 37;OriginalLineNo@1004 : Integer);
    VAR
      SalesHeader@1003 : Record 36;
      SalesLine2@1002 : Record 37;
      SalesLine3@1001 : Record 37;
    BEGIN
      IF SalesLine."Document Type" = SalesLine."Document Type"::"Blanket Order" THEN BEGIN
        SalesLine2.SETCURRENTKEY("Document Type","Blanket Order No.","Blanket Order Line No.");
        SalesLine2.SETRANGE("Blanket Order No.",SalesLine."Document No.");
        SalesLine2.SETFILTER("Blanket Order Line No.",'=%1',OriginalLineNo);
        SalesLine2.SETRANGE(Type,SalesLine.Type);
        SalesLine2.SETRANGE("No.",SalesLine."No.");
        CLEAR(SalesHeader);
        IF SalesLine2.FINDSET THEN
          REPEAT
            IF (SalesHeader."Document Type" <> SalesLine2."Document Type") OR
               (SalesHeader."No." <> SalesLine2."Document No.")
            THEN BEGIN
              SalesHeader.GET(SalesLine2."Document Type",SalesLine2."Document No.");
              SalesLine3.RESET;
              SalesLine3.SETRANGE("Document Type",SalesHeader."Document Type");
              SalesLine3.SETRANGE("Document No.",SalesHeader."No.");
              SalesLine3.SETRANGE("Blanket Order No.",SalesLine2."Blanket Order No.");
              SalesLine3.SETRANGE("Blanket Order Line No.",SalesLine2."Blanket Order Line No.");
              IF SalesLine3.FINDLAST THEN BEGIN
                SalesLine3."Blanket Order Line No." := SalesLine."Line No.";
                SalesLine3.MODIFY;
              END;
            END;
          UNTIL SalesLine2.NEXT = 0;
      END;
    END;

    LOCAL PROCEDURE UpdatePurchase@9();
    VAR
      PurchaseHeader@1000 : Record 38;
      PurchaseHeader2@1004 : Record 38;
      PurchaseLine@1003 : Record 39;
      PurchaseLineOld@1010 : Record 39;
      VATRateChangeLogEntry@1002 : Record 552;
      RecRef@1001 : RecordRef;
      NewVATProdPotingGroup@1007 : Code[20];
      NewGenProdPostingGroup@1008 : Code[20];
      StatusChanged@1005 : Boolean;
      ConvertVATProdPostingGroup@1009 : Boolean;
      ConvertGenProdPostingGroup@1006 : Boolean;
      RoundingPrecision@1011 : Decimal;
    BEGIN
      ProgressWindow.UPDATE(1,PurchaseHeader.TABLECAPTION);
      ConvertVATProdPostingGroup := ConvertVATProdPostGrp(VATRateChangeSetup."Update Purchase Documents");
      ConvertGenProdPostingGroup := ConvertGenProdPostGrp(VATRateChangeSetup."Update Purchase Documents");
      IF NOT ConvertVATProdPostingGroup AND NOT ConvertGenProdPostingGroup THEN
        EXIT;

      PurchaseHeader.SETFILTER(
        "Document Type",'%1..%2|%3',PurchaseHeader."Document Type"::Quote,PurchaseHeader."Document Type"::Invoice,
        PurchaseHeader."Document Type"::"Blanket Order");

      IF PurchaseHeader.FIND('-') THEN
        REPEAT
          StatusChanged := FALSE;
          IF CanUpdatePurchase(PurchaseHeader,ConvertGenProdPostingGroup,ConvertVATProdPostingGroup) THEN BEGIN
            IF VATRateChangeSetup."Ignore Status on Purch. Docs." THEN
              IF PurchaseHeader.Status <> PurchaseHeader.Status::Open THEN BEGIN
                PurchaseHeader2 := PurchaseHeader;
                PurchaseHeader.Status := PurchaseHeader.Status::Open;
                PurchaseHeader.MODIFY;
                StatusChanged := TRUE;
              END;
            IF PurchaseHeader.Status = PurchaseHeader.Status::Open THEN BEGIN
              PurchaseLine.SETRANGE("Document Type",PurchaseHeader."Document Type");
              PurchaseLine.SETRANGE("Document No.",PurchaseHeader."No.");
              IF PurchaseLine.FINDSET THEN
                REPEAT
                  IF LineInScope(
                       PurchaseLine."Gen. Prod. Posting Group",PurchaseLine."VAT Prod. Posting Group",ConvertGenProdPostingGroup,
                       ConvertVATProdPostingGroup)
                  THEN
                    IF (PurchaseLine."Receipt No." = '') AND
                       (PurchaseLine."Return Shipment No." = '') AND IncludeLine(PurchaseLine.Type,PurchaseLine."No.")
                    THEN
                      IF PurchaseLine.Quantity = PurchaseLine."Outstanding Quantity" THEN BEGIN
                        IF PurchaseHeader."Prices Including VAT" THEN
                          PurchaseLineOld := PurchaseLine;

                        RecRef.GETTABLE(PurchaseLine);
                        UpdateRec(
                          RecRef,ConvertVATProdPostGrp(VATRateChangeSetup."Update Purchase Documents"),
                          ConvertGenProdPostGrp(VATRateChangeSetup."Update Purchase Documents"));

                        IF PurchaseHeader."Prices Including VAT" AND VATRateChangeSetup."Perform Conversion" THEN BEGIN
                          RecRef.SETTABLE(PurchaseLine);
                          RoundingPrecision := GetRoundingPrecision(PurchaseHeader."Currency Code");
                          PurchaseLine.VALIDATE(
                            "Direct Unit Cost",
                            ROUND(
                              PurchaseLineOld."Direct Unit Cost" * (100 + PurchaseLine."VAT %") / (100 + PurchaseLineOld."VAT %"),
                              RoundingPrecision));
                        END;
                      END ELSE
                        IF VATRateChangeSetup."Perform Conversion" AND (PurchaseLine."Outstanding Quantity" <> 0) THEN BEGIN
                          NewVATProdPotingGroup := PurchaseLine."VAT Prod. Posting Group";
                          NewGenProdPostingGroup := PurchaseLine."Gen. Prod. Posting Group";
                          IF ConvertVATProdPostingGroup THEN
                            IF VATRateChangeConversion.GET(
                                 VATRateChangeConversion.Type::"VAT Prod. Posting Group",PurchaseLine."VAT Prod. Posting Group")
                            THEN
                              NewVATProdPotingGroup := VATRateChangeConversion."To Code";
                          IF ConvertGenProdPostingGroup THEN
                            IF VATRateChangeConversion.GET(
                                 VATRateChangeConversion.Type::"Gen. Prod. Posting Group",PurchaseLine."Gen. Prod. Posting Group")
                            THEN
                              NewGenProdPostingGroup := VATRateChangeConversion."To Code";
                          AddNewPurchaseLine(PurchaseLine,NewVATProdPotingGroup,NewGenProdPostingGroup);
                        END ELSE BEGIN
                          RecRef.GETTABLE(PurchaseLine);
                          InitVATRateChangeLogEntry(
                            VATRateChangeLogEntry,RecRef,PurchaseLine."Outstanding Quantity",PurchaseLine."Line No.");
                          VATRateChangeLogEntry.UpdateGroups(
                            PurchaseLine."Gen. Prod. Posting Group",PurchaseLine."Gen. Prod. Posting Group",
                            PurchaseLine."VAT Prod. Posting Group",PurchaseLine."VAT Prod. Posting Group");
                          WriteLogEntry(VATRateChangeLogEntry);
                        END;
                UNTIL PurchaseLine.NEXT = 0;
            END;
            IF StatusChanged THEN BEGIN
              PurchaseHeader.Status := PurchaseHeader2.Status;
              PurchaseHeader.MODIFY;
            END;
          END;
        UNTIL PurchaseHeader.NEXT = 0;
    END;

    LOCAL PROCEDURE CanUpdatePurchase@16(PurchaseHeader@1007 : Record 38;ConvertGenProdPostingGroup@1004 : Boolean;ConvertVATProdPostingGroup@1005 : Boolean) : Boolean;
    VAR
      PurchaseLine@1003 : Record 39;
      VATRateChangeLogEntry@1002 : Record 552;
      WhseValidateSourceLine@1000 : Codeunit 5777;
      RecRef@1001 : RecordRef;
      DescriptionTxt@1006 : Text[250];
    BEGIN
      WITH PurchaseLine DO BEGIN
        SETRANGE("Document Type",PurchaseHeader."Document Type");
        SETRANGE("Document No.",PurchaseHeader."No.");
        IF FINDSET THEN
          REPEAT
            DescriptionTxt := '';

            IF LineInScope("Gen. Prod. Posting Group","VAT Prod. Posting Group",ConvertGenProdPostingGroup,ConvertVATProdPostingGroup) THEN BEGIN
              //VG.SN 17.06.20 TB
              IF ("Outstanding Quantity" <> Quantity) AND ("Outstanding Quantity" <> 0) THEN
              VG_VATRateChangeConversion.CheckPurchaseLine(PurchaseLine,DescriptionTxt);
              //VG.EN 17.06.20 TB
              IF "Drop Shipment" AND ("Sales Order No." <> '') THEN
                DescriptionTxt := STRSUBSTNO(Text0004,"Line No.");
              IF "Special Order" AND ("Special Order Sales No." <> '') THEN
                DescriptionTxt := STRSUBSTNO(Text0005,"Line No.");
              IF ("Outstanding Quantity" <> Quantity) AND
                 WhseValidateSourceLine.WhseLinesExist(
                   DATABASE::"Purchase Line","Document Type","Document No.","Line No.",0,Quantity)
              THEN
                DescriptionTxt := Text0006;
              IF ("Outstanding Quantity" <> Quantity) AND (Type = Type::"Charge (Item)") THEN
                DescriptionTxt := STRSUBSTNO(Text0014,"Line No.",Type::"Charge (Item)");
              IF  "Prepmt. Amount Inv. (LCY)" <> 0 THEN
                DescriptionTxt := Text0011;

            END;
          UNTIL (NEXT = 0) OR (DescriptionTxt <> '');
      END;
      IF DescriptionTxt = '' THEN
        EXIT(TRUE);

      VATRateChangeLogEntry.INIT;
      RecRef.GETTABLE(PurchaseHeader);
      VATRateChangeLogEntry.INIT;
      VATRateChangeLogEntry."Record ID" := RecRef.RECORDID;
      VATRateChangeLogEntry."Table ID" := RecRef.NUMBER;
      VATRateChangeLogEntry.Description := DescriptionTxt;
      WriteLogEntry(VATRateChangeLogEntry);
    END;

    LOCAL PROCEDURE AddNewPurchaseLine@17(PurchaseLine@1001 : Record 39;VATProdPostingGroup@1000 : Code[20];GenProdPostingGroup@1002 : Code[20]);
    VAR
      NewPurchaseLine@1004 : Record 39;
      OldPurchaseLine@1005 : Record 39;
      PurchaseHeader@1006 : Record 38;
      OldReservationEntry@1009 : Record 337;
      NewReservationEntry@1010 : Record 337;
      OldItemChargeAssignmentPurch@1011 : Record 5805;
      NewItemChargeAssignmentPurch@1012 : Record 5805;
      VATRateChangeLogEntry@1007 : Record 552;
      RecRef@1003 : RecordRef;
      NewLineNo@1015 : Integer;
      QtyRemainder@1016 : Decimal;
      AmountRemainder@1017 : Decimal;
      RoundingPrecision@1018 : Decimal;
    BEGIN
      IF NOT GetNextPurchaseLineNo(PurchaseLine,NewLineNo) THEN
        EXIT;

      WITH NewPurchaseLine DO BEGIN
        INIT;
        NewPurchaseLine := PurchaseLine;
        "Line No." := NewLineNo;
        "Quantity Received" := 0;
        "Qty. Received (Base)" := 0;
        "Return Qty. Shipped" := 0;
        "Return Qty. Shipped (Base)" := 0;
        "Quantity Invoiced" := 0;
        "Qty. Invoiced (Base)" := 0;
        "Reserved Quantity" := 0;
        "Reserved Qty. (Base)" := 0;
        "Qty. Rcd. Not Invoiced" := 0;
        "Qty. Rcd. Not Invoiced (Base)" := 0;
        "Return Qty. Shipped Not Invd." := 0;
        "Ret. Qty. Shpd Not Invd.(Base)" := 0;
        "Qty. to Receive" := 0;
        "Qty. to Receive (Base)" := 0;
        "Return Qty. to Ship" := 0;
        "Return Qty. to Ship (Base)" := 0;
        "Qty. to Invoice" := 0;
        "Qty. to Invoice (Base)" := 0;
        "Amt. Rcd. Not Invoiced" := 0;
        "Amt. Rcd. Not Invoiced (LCY)" := 0;
        "Return Shpd. Not Invd." := 0;
        "Return Shpd. Not Invd. (LCY)" := 0;
        IF (GenProdPostingGroup <> '') AND ConvertGenProdPostGrp(VATRateChangeSetup."Update Purchase Documents") THEN
          VALIDATE("Gen. Prod. Posting Group",GenProdPostingGroup);
        IF (VATProdPostingGroup <> '') AND ConvertVATProdPostGrp(VATRateChangeSetup."Update Purchase Documents") THEN
          VALIDATE("VAT Prod. Posting Group",VATProdPostingGroup);
        VALIDATE(Quantity,PurchaseLine."Outstanding Quantity");
        VALIDATE("Qty. to Receive",PurchaseLine."Qty. to Receive");
        VALIDATE("Return Qty. to Ship",PurchaseLine."Return Qty. to Ship");
        IF ABS(PurchaseLine."Qty. to Invoice") > (ABS(PurchaseLine."Quantity Received") - ABS(PurchaseLine."Quantity Invoiced")) THEN
          VALIDATE(
            "Qty. to Invoice",PurchaseLine."Qty. to Invoice" - (PurchaseLine."Quantity Received" - PurchaseLine."Quantity Invoiced"))
        ELSE
          VALIDATE("Qty. to Invoice",0);

        PurchaseHeader.GET("Document Type","Document No.");
        RoundingPrecision := GetRoundingPrecision(PurchaseHeader."Currency Code");

        IF PurchaseHeader."Prices Including VAT" THEN
          VALIDATE(
            "Direct Unit Cost",
            ROUND(PurchaseLine."Direct Unit Cost" * (100 + "VAT %") / (100 + PurchaseLine."VAT %"),RoundingPrecision))
        ELSE
          VALIDATE("Direct Unit Cost",PurchaseLine."Direct Unit Cost");

        VALIDATE("Line Discount %",PurchaseLine."Line Discount %");
        INSERT;

        RecRef.GETTABLE(PurchaseLine);
        VATRateChangeLogEntry.INIT;
        VATRateChangeLogEntry."Record ID" := RecRef.RECORDID;
        VATRateChangeLogEntry."Table ID" := RecRef.NUMBER;
        VATRateChangeLogEntry.Description := STRSUBSTNO(Text0012,FORMAT(PurchaseLine."Line No."));
        VATRateChangeLogEntry.UpdateGroups(
          PurchaseLine."Gen. Prod. Posting Group",PurchaseLine."Gen. Prod. Posting Group",
          PurchaseLine."VAT Prod. Posting Group",PurchaseLine."VAT Prod. Posting Group");
        VATRateChangeLogEntry.Converted := TRUE;
        WriteLogEntry(VATRateChangeLogEntry);

        RecRef.GETTABLE(NewPurchaseLine);
        VATRateChangeLogEntry.INIT;
        VATRateChangeLogEntry."Record ID" := RecRef.RECORDID;
        VATRateChangeLogEntry."Table ID" := RecRef.NUMBER;
        VATRateChangeLogEntry.UpdateGroups(
          PurchaseLine."Gen. Prod. Posting Group","Gen. Prod. Posting Group",
          PurchaseLine."VAT Prod. Posting Group","VAT Prod. Posting Group");
        VATRateChangeLogEntry.Description := STRSUBSTNO(Text0013,FORMAT("Line No."),FORMAT(PurchaseLine."Line No."));
        VATRateChangeLogEntry.Converted := TRUE;
        WriteLogEntry(VATRateChangeLogEntry);
      END;

      UpdatePurchaseBlanketOrder(NewPurchaseLine,PurchaseLine."Line No.");

      OldReservationEntry.RESET;
      OldReservationEntry.SETCURRENTKEY("Source ID","Source Ref. No.","Source Type","Source Subtype");
      OldReservationEntry.SETRANGE("Source ID",PurchaseLine."Document No.");
      OldReservationEntry.SETRANGE("Source Ref. No.",PurchaseLine."Line No.");
      OldReservationEntry.SETRANGE("Source Type",DATABASE::"Purchase Line");
      OldReservationEntry.SETRANGE("Source Subtype",PurchaseLine."Document Type");
      OldReservationEntry.SETFILTER(
        "Reservation Status",'%1|%2',
        OldReservationEntry."Reservation Status"::Reservation,
        OldReservationEntry."Reservation Status"::Surplus);
      IF OldReservationEntry.FIND('-') THEN
        REPEAT
          NewReservationEntry := OldReservationEntry;
          NewReservationEntry."Source Ref. No." := NewLineNo;
          NewReservationEntry.MODIFY;
        UNTIL OldReservationEntry.NEXT = 0;

      CASE PurchaseLine.Type OF
        PurchaseLine.Type::Item:
          BEGIN
            OldItemChargeAssignmentPurch.RESET;
            OldItemChargeAssignmentPurch.SETCURRENTKEY("Applies-to Doc. Type","Applies-to Doc. No.","Applies-to Doc. Line No.");
            OldItemChargeAssignmentPurch.SETRANGE("Applies-to Doc. Type",PurchaseLine."Document Type");
            OldItemChargeAssignmentPurch.SETRANGE("Applies-to Doc. No.",PurchaseLine."Document No.");
            OldItemChargeAssignmentPurch.SETRANGE("Applies-to Doc. Line No.",PurchaseLine."Line No.");
            IF OldItemChargeAssignmentPurch.FINDSET THEN
              REPEAT
                QtyRemainder := OldItemChargeAssignmentPurch."Qty. to Assign";
                AmountRemainder := OldItemChargeAssignmentPurch."Amount to Assign";
                NewItemChargeAssignmentPurch := OldItemChargeAssignmentPurch;
                NewItemChargeAssignmentPurch."Line No." := GetNextItemChrgAssPurchLineNo(OldItemChargeAssignmentPurch);
                NewItemChargeAssignmentPurch."Applies-to Doc. Line No." := NewLineNo;
                NewItemChargeAssignmentPurch."Qty. to Assign" :=
                  ROUND(QtyRemainder / PurchaseLine.Quantity * PurchaseLine."Outstanding Quantity",UOMMgt.QtyRndPrecision);
                IF PurchaseLine."Quantity Received" - PurchaseLine."Quantity Invoiced" = 0 THEN
                  NewItemChargeAssignmentPurch."Qty. to Assign" := QtyRemainder;
                NewItemChargeAssignmentPurch."Amount to Assign" :=
                  ROUND(NewItemChargeAssignmentPurch."Qty. to Assign" * NewItemChargeAssignmentPurch."Unit Cost",RoundingPrecision);
                NewItemChargeAssignmentPurch.INSERT;
                QtyRemainder := QtyRemainder - NewItemChargeAssignmentPurch."Qty. to Assign";
                AmountRemainder := AmountRemainder - NewItemChargeAssignmentPurch."Amount to Assign";
                OldItemChargeAssignmentPurch."Qty. to Assign" := QtyRemainder;
                OldItemChargeAssignmentPurch."Amount to Assign" := AmountRemainder;
                OldItemChargeAssignmentPurch.MODIFY;
              UNTIL OldItemChargeAssignmentPurch.NEXT = 0;
          END;
      END;

      OldPurchaseLine.GET(PurchaseLine."Document Type",PurchaseLine."Document No.",PurchaseLine."Line No.");
      OldPurchaseLine.VALIDATE(Quantity,PurchaseLine."Quantity Received");

      OldPurchaseLine.VALIDATE("Direct Unit Cost",PurchaseLine."Direct Unit Cost");

      OldPurchaseLine.VALIDATE("Line Discount %",PurchaseLine."Line Discount %");
      OldPurchaseLine.VALIDATE("Qty. to Receive",0);
      OldPurchaseLine.VALIDATE("Return Qty. to Ship",0);
      IF ABS(PurchaseLine."Qty. to Invoice") > (ABS(PurchaseLine."Quantity Received") - ABS(PurchaseLine."Quantity Invoiced")) THEN
        OldPurchaseLine.VALIDATE("Qty. to Invoice",PurchaseLine."Quantity Received" - PurchaseLine."Quantity Invoiced")
      ELSE
        OldPurchaseLine.VALIDATE("Qty. to Invoice",PurchaseLine."Qty. to Invoice");

      OldPurchaseLine.MODIFY;

      //CopyText
      MI_VATRateChangeConversion.CopyPurchExtTextAndEditor(OldPurchaseLine, NewPurchaseLine); // MI.VAT.N 17.06.20
    END;

    [External]
    PROCEDURE GetNextPurchaseLineNo@18(PurchaseLine@1001 : Record 39;VAR NextLineNo@1002 : Integer) : Boolean;
    VAR
      PurchaseLine2@1000 : Record 39;
    BEGIN
      PurchaseLine2.RESET;
      PurchaseLine2.SETRANGE("Document Type",PurchaseLine."Document Type");
      PurchaseLine2.SETRANGE("Document No.",PurchaseLine."Document No.");
      PurchaseLine2 := PurchaseLine;
      IF PurchaseLine2.FIND('>') THEN
        NextLineNo := PurchaseLine."Line No." + (PurchaseLine2."Line No." - PurchaseLine."Line No.") DIV 2;
      IF (NextLineNo = PurchaseLine."Line No.") OR (NextLineNo = 0) THEN BEGIN
        PurchaseLine2.FINDLAST;
        NextLineNo := PurchaseLine2."Line No." + 10000;
      END;
      EXIT(NextLineNo <> PurchaseLine."Line No.");
    END;

    LOCAL PROCEDURE UpdatePurchaseBlanketOrder@22(PurchaseLine@1000 : Record 39;OriginalLineNo@1004 : Integer);
    VAR
      PurchaseHeader@1003 : Record 38;
      PurchaseLine2@1002 : Record 39;
      PurchaseLine3@1001 : Record 39;
    BEGIN
      IF PurchaseLine."Document Type" = PurchaseLine."Document Type"::"Blanket Order" THEN BEGIN
        PurchaseLine2.SETCURRENTKEY("Document Type","Blanket Order No.","Blanket Order Line No.");
        PurchaseLine2.SETRANGE("Blanket Order No.",PurchaseLine."Document No.");
        PurchaseLine2.SETFILTER("Blanket Order Line No.",'=%1',OriginalLineNo);
        PurchaseLine2.SETRANGE(Type,PurchaseLine.Type);
        PurchaseLine2.SETRANGE("No.",PurchaseLine."No.");
        CLEAR(PurchaseHeader);
        IF PurchaseLine2.FIND('-') THEN
          REPEAT
            IF (PurchaseHeader."Document Type" <> PurchaseLine2."Document Type") OR
               (PurchaseHeader."No." <> PurchaseLine2."Document No.")
            THEN BEGIN
              PurchaseHeader.GET(PurchaseLine2."Document Type",PurchaseLine2."Document No.");
              PurchaseLine3.RESET;
              PurchaseLine3.SETRANGE("Document Type",PurchaseHeader."Document Type");
              PurchaseLine3.SETRANGE("Document No.",PurchaseHeader."No.");
              PurchaseLine3.SETRANGE("Blanket Order No.",PurchaseLine2."Blanket Order No.");
              PurchaseLine3.SETRANGE("Blanket Order Line No.",PurchaseLine2."Blanket Order Line No.");
              IF PurchaseLine3.FINDLAST THEN BEGIN
                PurchaseLine3."Blanket Order Line No." := PurchaseLine."Line No.";
                PurchaseLine3.MODIFY;
              END;
            END;
          UNTIL PurchaseLine2.NEXT = 0;
      END;
    END;

    LOCAL PROCEDURE LineInScope@13(GenProdPostingGroup@1000 : Code[20];VATProdPostingGroup@1001 : Code[20];ConvertGenProdPostingGroup@1002 : Boolean;ConvertVATProdPostingGroup@1003 : Boolean) : Boolean;
    BEGIN
      IF ConvertGenProdPostingGroup THEN
        IF VATRateChangeConversion.GET(VATRateChangeConversion.Type::"Gen. Prod. Posting Group",GenProdPostingGroup) THEN
          EXIT(TRUE);
      IF ConvertVATProdPostingGroup THEN
        IF VATRateChangeConversion.GET(VATRateChangeConversion.Type::"VAT Prod. Posting Group",VATProdPostingGroup) THEN
          EXIT(TRUE);
      EXIT(FALSE);
    END;

    [External]
    PROCEDURE GetNextSalesLineNo@1050(SalesLine@1000 : Record 37;VAR NextLineNo@1001 : Integer) : Boolean;
    VAR
      SalesLine2@1002 : Record 37;
    BEGIN
      SalesLine2.RESET;
      SalesLine2.SETRANGE("Document Type",SalesLine."Document Type");
      SalesLine2.SETRANGE("Document No.",SalesLine."Document No.");
      SalesLine2 := SalesLine;
      IF SalesLine2.FIND('>') THEN
        NextLineNo := SalesLine."Line No." + (SalesLine2."Line No." - SalesLine."Line No.") DIV 2;
      IF (NextLineNo = SalesLine."Line No.") OR (NextLineNo = 0) THEN BEGIN
        SalesLine2.FINDLAST;
        NextLineNo := SalesLine2."Line No." + 10000;
      END;
      EXIT(NextLineNo <> SalesLine."Line No.");
    END;

    LOCAL PROCEDURE UpdateServPriceAdjDetail@14();
    VAR
      VatRateChangeConversion@1001 : Record 551;
      ServPriceAdjustmentDetail@1000 : Record 6083;
      ServPriceAdjustmentDetailNew@1002 : Record 6083;
      VATRateChangeLogEntry@1003 : Record 552;
      RecRef@1004 : RecordRef;
    BEGIN
      IF VATRateChangeSetup."Update Serv. Price Adj. Detail" <>
         VATRateChangeSetup."Update Serv. Price Adj. Detail"::"Gen. Prod. Posting Group"
      THEN
        EXIT;
      VatRateChangeConversion.SETRANGE(Type,VatRateChangeConversion.Type::"Gen. Prod. Posting Group");
      IF VatRateChangeConversion.FINDSET THEN
        REPEAT
          WITH ServPriceAdjustmentDetail DO BEGIN
            SETRANGE("Gen. Prod. Posting Group",VatRateChangeConversion."From Code");
            IF FINDSET THEN
              REPEAT
                VATRateChangeLogEntry.INIT;
                RecRef.GETTABLE(ServPriceAdjustmentDetailNew);
                VATRateChangeLogEntry."Record ID" := RecRef.RECORDID;
                VATRateChangeLogEntry."Table ID" := DATABASE::"Serv. Price Adjustment Detail";
                VATRateChangeLogEntry."Old Gen. Prod. Posting Group" := "Gen. Prod. Posting Group";
                VATRateChangeLogEntry."New Gen. Prod. Posting Group" := VatRateChangeConversion."To Code";
                ServPriceAdjustmentDetailNew := ServPriceAdjustmentDetail;
                IF VATRateChangeSetup."Perform Conversion" THEN BEGIN
                  ServPriceAdjustmentDetailNew.RENAME(
                    "Serv. Price Adjmt. Gr. Code",Type,"No.","Work Type",VatRateChangeConversion."To Code");
                  VATRateChangeLogEntry.Converted := TRUE
                END ELSE
                  VATRateChangeLogEntry.Description := STRSUBSTNO(Text0009,VATRateChangeSetup.FIELDCAPTION("Perform Conversion"));
                WriteLogEntry(VATRateChangeLogEntry);
              UNTIL NEXT = 0;
          END;
        UNTIL VatRateChangeConversion.NEXT = 0;
    END;

    LOCAL PROCEDURE GetRoundingPrecision@19(CurrencyCode@1000 : Code[10]) : Decimal;
    VAR
      Currency@1001 : Record 4;
    BEGIN
      IF CurrencyCode = '' THEN
        Currency.InitRoundingPrecision
      ELSE
        Currency.GET(CurrencyCode);
      EXIT(Currency."Unit-Amount Rounding Precision");
    END;

    LOCAL PROCEDURE CanUpdateService@21(ServiceLine@1007 : Record 5902) : Boolean;
    VAR
      ServiceHeader@1002 : Record 5900;
      VATRateChangeLogEntry@1000 : Record 552;
      RecRef@1001 : RecordRef;
      DescriptionTxt@1006 : Text[250];
    BEGIN
      DescriptionTxt := '';
      WITH ServiceLine DO BEGIN
        IF "Shipment No." <> '' THEN
          DescriptionTxt := Text0010;
      END;
      IF DescriptionTxt = '' THEN
        EXIT(TRUE);

      VATRateChangeLogEntry.INIT;
      ServiceHeader.GET(ServiceLine."Document Type",ServiceLine."Document No.");
      RecRef.GETTABLE(ServiceHeader);
      VATRateChangeLogEntry.INIT;
      VATRateChangeLogEntry."Record ID" := RecRef.RECORDID;
      VATRateChangeLogEntry."Table ID" := RecRef.NUMBER;
      VATRateChangeLogEntry.Description := DescriptionTxt;
      WriteLogEntry(VATRateChangeLogEntry);
    END;

    LOCAL PROCEDURE UpdateService@23();
    VAR
      ServiceHeader@1008 : Record 5900;
      ServiceHeader2@1011 : Record 5900;
      ServiceLine@1000 : Record 5902;
      ServiceLineOld@1007 : Record 5902;
      VATRateChangeLogEntry@1004 : Record 552;
      RecRef@1001 : RecordRef;
      NewVATProdPotingGroup@1003 : Code[20];
      NewGenProdPostingGroup@1002 : Code[20];
      ConvertVATProdPostingGroup@1006 : Boolean;
      ConvertGenProdPostingGroup@1005 : Boolean;
      ServiceHeaderStatusChanged@1012 : Boolean;
      RoundingPrecision@1009 : Decimal;
      LastDocNo@1010 : Code[20];
    BEGIN
      ProgressWindow.UPDATE(1,ServiceLine.TABLECAPTION);
      ConvertVATProdPostingGroup := ConvertVATProdPostGrp(VATRateChangeSetup."Update Service Docs.");
      ConvertGenProdPostingGroup := ConvertGenProdPostGrp(VATRateChangeSetup."Update Service Docs.");
      IF NOT ConvertVATProdPostingGroup AND NOT ConvertGenProdPostingGroup THEN
        EXIT;

      WITH ServiceLine DO BEGIN
        SETFILTER("Document Type",'%1|%2|%3',"Document Type"::Quote,"Document Type"::Order,"Document Type"::Invoice);
        SETRANGE("Shipment No.",'');
        LastDocNo := '';
        IF FIND('-') THEN
          REPEAT
            IF LineInScope("Gen. Prod. Posting Group","VAT Prod. Posting Group",ConvertGenProdPostingGroup,ConvertVATProdPostingGroup) THEN
              IF CanUpdateService(ServiceLine) AND IncludeServiceLine(Type,"No.") THEN BEGIN
                IF LastDocNo <> "Document No." THEN BEGIN
                  ServiceHeader.GET("Document Type","Document No.");
                  LastDocNo := ServiceHeader."No.";
                END;

                IF VATRateChangeSetup."Ignore Status on Service Docs." THEN
                  IF ServiceHeader."Release Status" <> ServiceHeader."Release Status"::Open THEN BEGIN
                    ServiceHeader2 := ServiceHeader;
                    ServiceHeader."Release Status" := ServiceHeader."Release Status"::Open;
                    ServiceHeader.MODIFY;
                    ServiceHeaderStatusChanged := TRUE;
                  END;

                IF Quantity = "Outstanding Quantity" THEN BEGIN
                  IF ServiceHeader."Prices Including VAT" THEN
                    ServiceLineOld := ServiceLine;

                  RecRef.GETTABLE(ServiceLine);
                  UpdateRec(
                    RecRef,ConvertVATProdPostGrp(VATRateChangeSetup."Update Service Docs."),
                    ConvertGenProdPostGrp(VATRateChangeSetup."Update Service Docs."));

                  IF ServiceHeader."Prices Including VAT" AND VATRateChangeSetup."Perform Conversion" THEN BEGIN
                    RecRef.SETTABLE(ServiceLine);
                    RoundingPrecision := GetRoundingPrecision(ServiceHeader."Currency Code");
                    VALIDATE("Unit Price",ROUND("Unit Price" * (100 + "VAT %") / (100 + ServiceLineOld."VAT %"),RoundingPrecision))
                  END;
                END ELSE
                  IF VATRateChangeSetup."Perform Conversion" AND ("Outstanding Quantity" <> 0) THEN BEGIN
                    NewVATProdPotingGroup := "VAT Prod. Posting Group";
                    NewGenProdPostingGroup := "Gen. Prod. Posting Group";
                    IF ConvertVATProdPostingGroup THEN
                      IF VATRateChangeConversion.GET(
                           VATRateChangeConversion.Type::"VAT Prod. Posting Group","VAT Prod. Posting Group")
                      THEN
                        NewVATProdPotingGroup := VATRateChangeConversion."To Code";
                    IF ConvertGenProdPostingGroup THEN
                      IF VATRateChangeConversion.GET(
                           VATRateChangeConversion.Type::"Gen. Prod. Posting Group","Gen. Prod. Posting Group")
                      THEN
                        NewGenProdPostingGroup := VATRateChangeConversion."To Code";
                    AddNewServiceLine(ServiceLine,NewVATProdPotingGroup,NewGenProdPostingGroup);
                  END ELSE BEGIN
                    RecRef.GETTABLE(ServiceLine);
                    InitVATRateChangeLogEntry(VATRateChangeLogEntry,RecRef,"Outstanding Quantity","Line No.");
                    VATRateChangeLogEntry.UpdateGroups(
                      "Gen. Prod. Posting Group","Gen. Prod. Posting Group","VAT Prod. Posting Group","VAT Prod. Posting Group");
                    WriteLogEntry(VATRateChangeLogEntry);
                  END;

                IF ServiceHeaderStatusChanged THEN BEGIN
                  ServiceHeader."Release Status" := ServiceHeader2."Release Status";
                  ServiceHeader.MODIFY;
                  ServiceHeaderStatusChanged := FALSE;
                END;
              END;
          UNTIL NEXT = 0;
      END;
    END;

    LOCAL PROCEDURE AddNewServiceLine@27(ServiceLine@1022 : Record 5902;VATProdPostingGroup@1001 : Code[20];GenProdPostingGroup@1002 : Code[20]);
    VAR
      NewServiceLine@1003 : Record 5902;
      OldServiceLine@1005 : Record 5902;
      ServiceHeader@1006 : Record 5900;
      OldReservationEntry@1009 : Record 337;
      NewReservationEntry@1010 : Record 337;
      VATRateChangeLogEntry@1004 : Record 552;
      RecRef@1000 : RecordRef;
      NewLineNo@1015 : Integer;
      RoundingPrecision@1007 : Decimal;
    BEGIN
      IF NOT GetNextServiceLineNo(ServiceLine,NewLineNo) THEN
        EXIT;

      WITH NewServiceLine DO BEGIN
        INIT;
        NewServiceLine := ServiceLine;
        "Line No." := NewLineNo;
        "Qty. to Invoice" := 0;
        "Qty. to Ship" := 0;
        "Qty. Shipped Not Invoiced" := 0;
        "Quantity Shipped" := 0;
        "Quantity Invoiced" := 0;
        "Qty. to Invoice (Base)" := 0;
        "Qty. to Ship (Base)" := 0;
        "Qty. Shipped Not Invd. (Base)" := 0;
        "Qty. Shipped (Base)" := 0;
        "Qty. Invoiced (Base)" := 0;
        "Qty. to Consume" := 0;
        "Quantity Consumed" := 0;
        "Qty. to Consume (Base)" := 0;
        "Qty. Consumed (Base)" := 0;
        IF (GenProdPostingGroup <> '') AND ConvertGenProdPostGrp(VATRateChangeSetup."Update Service Docs.") THEN
          VALIDATE("Gen. Prod. Posting Group",GenProdPostingGroup);
        IF (VATProdPostingGroup <> '') AND ConvertVATProdPostGrp(VATRateChangeSetup."Update Service Docs.") THEN
          VALIDATE("VAT Prod. Posting Group",VATProdPostingGroup);

        VALIDATE(Quantity,ServiceLine."Outstanding Quantity");
        VALIDATE("Qty. to Ship",ServiceLine."Qty. to Ship");
        VALIDATE("Qty. to Consume",ServiceLine."Qty. to Consume");
        IF ABS(ServiceLine."Qty. to Invoice") >
           (ABS(ServiceLine."Quantity Shipped") - ABS(ServiceLine."Quantity Invoiced"))
        THEN
          VALIDATE(
            "Qty. to Invoice",
            ServiceLine."Qty. to Invoice" - (ServiceLine."Quantity Shipped" - ServiceLine."Quantity Invoiced"))
        ELSE
          VALIDATE("Qty. to Invoice",0);
        ServiceHeader.GET("Document Type","Document No.");
        RoundingPrecision := GetRoundingPrecision(ServiceHeader."Currency Code");
        IF ServiceHeader."Prices Including VAT" THEN
          VALIDATE("Unit Price",ROUND(ServiceLine."Unit Price" * (100 + "VAT %") / (100 + ServiceLine."VAT %"),RoundingPrecision))
        ELSE
          VALIDATE("Unit Price",ServiceLine."Unit Price");
        VALIDATE("Line Discount %",ServiceLine."Line Discount %");
        INSERT;
        RecRef.GETTABLE(ServiceLine);
        VATRateChangeLogEntry.INIT;
        VATRateChangeLogEntry."Record ID" := RecRef.RECORDID;
        VATRateChangeLogEntry."Table ID" := RecRef.NUMBER;
        VATRateChangeLogEntry.Description := STRSUBSTNO(Text0012,FORMAT(ServiceLine."Line No."));
        VATRateChangeLogEntry.UpdateGroups(
          ServiceLine."Gen. Prod. Posting Group",ServiceLine."Gen. Prod. Posting Group",
          ServiceLine."VAT Prod. Posting Group",ServiceLine."VAT Prod. Posting Group");
        VATRateChangeLogEntry.Converted := TRUE;
        WriteLogEntry(VATRateChangeLogEntry);

        RecRef.GETTABLE(NewServiceLine);
        VATRateChangeLogEntry.INIT;
        VATRateChangeLogEntry."Record ID" := RecRef.RECORDID;
        VATRateChangeLogEntry."Table ID" := RecRef.NUMBER;
        VATRateChangeLogEntry.UpdateGroups(
          ServiceLine."Gen. Prod. Posting Group","Gen. Prod. Posting Group",
          ServiceLine."VAT Prod. Posting Group","VAT Prod. Posting Group");
        VATRateChangeLogEntry.Description := STRSUBSTNO(Text0013,FORMAT("Line No."),FORMAT(ServiceLine."Line No."));
        VATRateChangeLogEntry.Converted := TRUE;
        WriteLogEntry(VATRateChangeLogEntry);
      END;

      ServiceLine.CALCFIELDS("Reserved Quantity");
      IF ServiceLine."Reserved Quantity" <> 0 THEN BEGIN
        OldReservationEntry.RESET;
        OldReservationEntry.SETCURRENTKEY("Source ID","Source Ref. No.","Source Type","Source Subtype");
        OldReservationEntry.SETRANGE("Source ID",ServiceLine."Document No.");
        OldReservationEntry.SETRANGE("Source Ref. No.",ServiceLine."Line No.");
        OldReservationEntry.SETRANGE("Source Type",DATABASE::"Service Line");
        OldReservationEntry.SETRANGE("Source Subtype",ServiceLine."Document Type");
        OldReservationEntry.SETRANGE("Reservation Status",OldReservationEntry."Reservation Status"::Reservation);
        IF OldReservationEntry.FINDSET THEN
          REPEAT
            NewReservationEntry := OldReservationEntry;
            NewReservationEntry."Source Ref. No." := NewLineNo;
            NewReservationEntry.MODIFY;
          UNTIL OldReservationEntry.NEXT = 0;
      END;

      OldReservationEntry.RESET;
      OldReservationEntry.SETCURRENTKEY("Source ID","Source Ref. No.","Source Type","Source Subtype");
      OldReservationEntry.SETRANGE("Source ID",ServiceLine."Document No.");
      OldReservationEntry.SETRANGE("Source Ref. No.",ServiceLine."Line No.");
      OldReservationEntry.SETRANGE("Source Type",DATABASE::"Service Line");
      OldReservationEntry.SETRANGE("Source Subtype",ServiceLine."Document Type");
      OldReservationEntry.SETRANGE("Reservation Status",OldReservationEntry."Reservation Status"::Surplus);
      IF OldReservationEntry.FIND('-') THEN
        REPEAT
          NewReservationEntry := OldReservationEntry;
          NewReservationEntry."Source Ref. No." := NewLineNo;
          NewReservationEntry.MODIFY;
        UNTIL OldReservationEntry.NEXT = 0;

      OldServiceLine.GET(ServiceLine."Document Type",ServiceLine."Document No.",ServiceLine."Line No.");
      OldServiceLine.VALIDATE(Quantity,ServiceLine."Quantity Shipped");
      OldServiceLine.VALIDATE("Unit Price",ServiceLine."Unit Price");
      OldServiceLine.VALIDATE("Line Discount %",ServiceLine."Line Discount %");
      OldServiceLine.VALIDATE("Qty. to Ship",0);
      OldServiceLine.VALIDATE("Qty. to Consume",0);
      IF ABS(OldServiceLine."Qty. to Invoice") >
         (ABS(OldServiceLine."Quantity Shipped") - ABS(OldServiceLine."Quantity Consumed") - ABS(ServiceLine."Quantity Invoiced"))
      THEN
        OldServiceLine.VALIDATE(
          "Qty. to Invoice",OldServiceLine."Qty. to Invoice" - ServiceLine."Quantity Shipped" - OldServiceLine."Quantity Consumed")
      ELSE
        OldServiceLine.VALIDATE("Qty. to Invoice",OldServiceLine."Qty. to Invoice");
      OldServiceLine.MODIFY;
    END;

    [External]
    PROCEDURE GetNextServiceLineNo@31(ServiceLine@1000 : Record 5902;VAR NextLineNo@1001 : Integer) : Boolean;
    VAR
      ServiceLine2@1002 : Record 5902;
    BEGIN
      ServiceLine2.RESET;
      ServiceLine2.SETRANGE("Document Type",ServiceLine."Document Type");
      ServiceLine2.SETRANGE("Document No.",ServiceLine."Document No.");
      ServiceLine2 := ServiceLine;
      IF ServiceLine2.FIND('>') THEN
        NextLineNo := ServiceLine."Line No." + (ServiceLine2."Line No." - ServiceLine."Line No.") DIV 2;
      IF (NextLineNo = ServiceLine."Line No.") OR (NextLineNo = 0)THEN BEGIN
        ServiceLine2.FINDLAST;
        NextLineNo := ServiceLine2."Line No." + 10000;
      END;
      EXIT(NextLineNo <> ServiceLine."Line No.");
    END;

    LOCAL PROCEDURE GetNextItemChrgAssSaleLineNo@51(ItemChargeAssignmentSales@1002 : Record 5809) : Integer;
    VAR
      ItemChargeAssignmentSales2@1000 : Record 5809;
      ExitValue@1001 : Integer;
    BEGIN
      ExitValue := 10000;
      ItemChargeAssignmentSales2.RESET;
      ItemChargeAssignmentSales2.SETCURRENTKEY("Document Type","Document No.","Document Line No.");
      ItemChargeAssignmentSales2.SETRANGE("Document Type",ItemChargeAssignmentSales."Document Type");
      ItemChargeAssignmentSales2.SETRANGE("Document No.",ItemChargeAssignmentSales."Document No.");
      ItemChargeAssignmentSales2.SETRANGE("Document Line No.",ItemChargeAssignmentSales."Document Line No.");
      IF ItemChargeAssignmentSales2.FINDLAST THEN
        ExitValue := ItemChargeAssignmentSales2."Line No." + 10000;
      EXIT(ExitValue);
    END;

    LOCAL PROCEDURE GetNextItemChrgAssPurchLineNo@50(ItemChargeAssignmentPurch@1002 : Record 5805) : Integer;
    VAR
      ItemChargeAssignmentPurch2@1000 : Record 5805;
      ExitValue@1001 : Integer;
    BEGIN
      ExitValue := 10000;
      ItemChargeAssignmentPurch2.RESET;
      ItemChargeAssignmentPurch2.SETCURRENTKEY("Document Type","Document No.","Document Line No.");
      ItemChargeAssignmentPurch2.SETRANGE("Document Type",ItemChargeAssignmentPurch."Document Type");
      ItemChargeAssignmentPurch2.SETRANGE("Document No.",ItemChargeAssignmentPurch."Document No.");
      ItemChargeAssignmentPurch2.SETRANGE("Document Line No.",ItemChargeAssignmentPurch."Document Line No.");
      IF ItemChargeAssignmentPurch2.FINDLAST THEN
        ExitValue := ItemChargeAssignmentPurch2."Line No." + 10000;
      EXIT(ExitValue);
    END;

    LOCAL PROCEDURE AreTablesSelected@15() : Boolean;
    BEGIN
      WITH VATRateChangeSetup DO BEGIN
        IF "Update Gen. Prod. Post. Groups" <> "Update Gen. Prod. Post. Groups"::No THEN
          EXIT(TRUE);
        IF "Update G/L Accounts" <> "Update G/L Accounts"::No THEN
          EXIT(TRUE);
        IF "Update Items" <> "Update Items"::No THEN
          EXIT(TRUE);
        IF "Update Item Templates" <> "Update Item Templates"::No THEN
          EXIT(TRUE);
        IF "Update Item Charges" <> "Update Item Charges"::No THEN
          EXIT(TRUE);
        IF "Update Resources" <> "Update Resources"::No THEN
          EXIT(TRUE);
        IF "Update Gen. Journal Lines" <> "Update Gen. Journal Lines"::No THEN
          EXIT(TRUE);
        IF "Update Gen. Journal Allocation" <> "Update Gen. Journal Allocation"::No THEN
          EXIT(TRUE);
        IF "Update Std. Gen. Jnl. Lines" <> "Update Std. Gen. Jnl. Lines"::No THEN
          EXIT(TRUE);
        IF "Update Res. Journal Lines" <> "Update Res. Journal Lines"::No THEN
          EXIT(TRUE);
        IF "Update Job Journal Lines" <> "Update Job Journal Lines"::No THEN
          EXIT(TRUE);
        IF "Update Requisition Lines" <> "Update Requisition Lines"::No THEN
          EXIT(TRUE);
        IF "Update Std. Item Jnl. Lines" <> "Update Std. Item Jnl. Lines"::No THEN
          EXIT(TRUE);
        IF "Update Service Docs." <> "Update Service Docs."::No THEN
          EXIT(TRUE);
        IF "Update Serv. Price Adj. Detail" <> "Update Serv. Price Adj. Detail"::No THEN
          EXIT(TRUE);
        IF "Update Sales Documents" <> "Update Sales Documents"::No THEN
          EXIT(TRUE);
        IF "Update Purchase Documents" <> "Update Purchase Documents"::No THEN
          EXIT(TRUE);
        IF "Update Production Orders" <> "Update Production Orders"::No THEN
          EXIT(TRUE);
        IF "Update Work Centers" <> "Update Work Centers"::No THEN
          EXIT(TRUE);
        IF "Update Machine Centers" <> "Update Machine Centers"::No THEN
          EXIT(TRUE);
        IF "Update Reminders" <> "Update Reminders"::No THEN
          EXIT(TRUE);
        IF "Update Finance Charge Memos" <> "Update Finance Charge Memos"::No THEN
          EXIT(TRUE);
      END;
      EXIT(FALSE)
    END;

    LOCAL PROCEDURE IncludeLine@25(Type@1000 : ' ,G/L Account,Item,Resource';No@1001 : Code[20]) : Boolean;
    BEGIN
      CASE Type OF
        Type::"G/L Account":
          EXIT(IncludeGLAccount(No));
        Type::Item:
          EXIT(IncludeItem(No));
        Type::Resource:
          EXIT(IncludeRes(No));
      END;
      EXIT(TRUE);
    END;

    LOCAL PROCEDURE IncludeGLAccount@26(No@1000 : Code[20]) : Boolean;
    VAR
      GLAccount@1001 : Record 15;
    BEGIN
      IF VATRateChangeSetup."Account Filter" = '' THEN
        EXIT(TRUE);
      GLAccount."No." := No;
      GLAccount.SETFILTER("No.",VATRateChangeSetup."Account Filter");
      EXIT(GLAccount.FIND);
    END;

    LOCAL PROCEDURE IncludeItem@28(No@1000 : Code[20]) : Boolean;
    VAR
      Item@1001 : Record 27;
    BEGIN
      IF VATRateChangeSetup."Item Filter" = '' THEN
        EXIT(TRUE);
      Item."No." := No;
      Item.SETFILTER("No.",VATRateChangeSetup."Item Filter");
      EXIT(Item.FIND);
    END;

    LOCAL PROCEDURE IncludeRes@29(No@1000 : Code[20]) : Boolean;
    VAR
      Res@1001 : Record 156;
    BEGIN
      IF VATRateChangeSetup."Resource Filter" = '' THEN
        EXIT(TRUE);
      Res."No." := No;
      Res.SETFILTER("No.",VATRateChangeSetup."Resource Filter");
      EXIT(Res.FIND);
    END;

    LOCAL PROCEDURE IncludeServiceLine@30(Type@1000 : ' ,Item,Resource,Cost,G/L Account';No@1001 : Code[20]) : Boolean;
    BEGIN
      CASE Type OF
        Type::"G/L Account":
          EXIT(IncludeGLAccount(No));
        Type::Item:
          EXIT(IncludeItem(No));
        Type::Resource:
          EXIT(IncludeRes(No));
      END;
      EXIT(TRUE);
    END;

    LOCAL PROCEDURE InitVATRateChangeLogEntry@34(VAR VATRateChangeLogEntry@1001 : Record 552;RecRef@1002 : RecordRef;OutstandingQuantity@1003 : Decimal;LineNo@1004 : Integer);
    BEGIN
      VATRateChangeLogEntry.INIT;
      VATRateChangeLogEntry."Record ID" := RecRef.RECORDID;
      VATRateChangeLogEntry."Table ID" := RecRef.NUMBER;
      IF (OutstandingQuantity = 0) AND VATRateChangeSetup."Perform Conversion" THEN
        VATRateChangeLogEntry.Description := Text0007
      ELSE BEGIN
        VATRateChangeLogEntry.Description :=
          STRSUBSTNO(Text0009,VATRateChangeSetup.FIELDCAPTION("Perform Conversion"));
        IF OutstandingQuantity <> 0 THEN
          VATRateChangeLogEntry.Description := STRSUBSTNO(Text0017,LineNo)
      END;
    END;

    BEGIN
    {
      +--------------------------------------------------------------+
      |                  Copyright MODUS Consult AG                  |
      |                        Engineering                           |
      +--------------------------------------------------------------+
      Module    Date      User     Reference  Description
      MI.VAT    15.06.20  BS                  Call Codeunit "MI VAT Rate Change Conversion" for Update Industry

      +--------------------------------------------------------------+
      |           Copyright MODUS Consult AG                         |
      |               MODUS Configurator                             |
      +--------------------------------------------------------------+
      Modul     Date      User      Description
      VG        17.06.20 TB         Check Lines and copy date
    }
    END.
  }
}

OBJECT Codeunit 5022744 VG_VAT Rate Change Conversion
{
  OBJECT-PROPERTIES
  {
    Date=23.06.20;
    Time=12:00:00;
    Version List=VG14.00.VAT;
  }
  PROPERTIES
  {
    OnRun=BEGIN
          END;

  }
  CODE
  {
    VAR
      LicenseCheck@5137140 : Codeunit 5130102;
      SubposTxt@5137141 : TextConst 'DEU=Die Auftragszeile %1 vom Typ ''%2''ist eine Untersposition und  wurde teilweise geliefert/fakturiert. Aktualisieren Sie den Auftrag manuell.;ENU=The order line %1 of type %2 is a Sub-Item Position and have been partial Shipped/Invoiced. Update the order manually.';
      SetTxt@5137142 : TextConst 'DEU=Die Auftragszeile %1 vom Typ ''%2'' ist ein Set und wurde teilweise geliefert/fakturiert. Aktualisieren Sie den Auftrag manuell.;ENU=The order line %1 of type %2 is a Set Item and have been partial Shipped/Invoiced. Update the order manually.';
      ProdOrderTxt@5137143 : TextConst 'DEU=Die Auftragszeile %1 vom Typ ''%2'' wurde teilweise geliefert/fakturiert. Fr diese Zeile sind Fertigungsauftrge vorhanden. Aktualisieren Sie den Auftrag manuell.;ENU=The order line %1 of type %2 have been partial Shipped/Invoiced.Production orders exist for this line. Update the order manually.';
      VarBOMTxt@5137144 : TextConst 'DEU=Die Auftragszeile %1 vom Typ ''%2'' wurde teilweise geliefert/fakturiert. Fr diese Zeile ist eine zertifizierte Variantenstckliste vorhanden. Aktualisieren Sie den Auftrag manuell.;ENU=The order line %1 of type %2 have been partial Shipped/Invoiced. A certified variant BOM exists for this line. Update the order manually.';
      GenSubTxt@5137145 : TextConst 'DEU=Die Auftragszeile %1 vom Typ ''%2'' hat Unterpositionen und wurde teilweise geliefert/fakturiert. Aktualisieren Sie den Auftrag manuell.;ENU=Sub-Items assigned to the order line %1 of type %2  and it have been partial Shipped/Invoiced. Update the order manually.';

    PROCEDURE CheckSalesLine@5137142(SalesHeader@5137142 : Record 36;SalesLine@5137140 : Record 37;VAR DescriptionTxt@5137141 : Text[250]);
    VAR
      ItemL@5137143 : Record 27;
      ProductionOrderL@5137144 : Record 5405;
      VariantBOMHeaderL@5137145 : Record 5022740;
      SalesLineSubL@5137146 : Record 37;
    BEGIN
      IF LicenseCheck.VGALicense THEN BEGIN
        IF SalesLine.Type IN[SalesLine.Type::Item,SalesLine.Type::"Charge (Item)"] THEN BEGIN
          IF SalesLine."Attached to Line No." <> 0 THEN
            DescriptionTxt :=  STRSUBSTNO(SubposTxt,SalesLine."Line No.",SalesLine.Type);

          IF ItemL.GET(SalesLine."No.") AND (ItemL."M365 Set" OR ItemL."M365 Generate Subpositions") THEN BEGIN
            IF ItemL."M365 Set" THEN
              DescriptionTxt :=  STRSUBSTNO(SetTxt,SalesLine."Line No.",SalesLine.Type);
            IF ItemL."M365 Generate Subpositions" THEN BEGIN
              SalesLineSubL.SETCURRENTKEY("Document Type","Document No.","Attached to Line No.");
              SalesLineSubL.SETRANGE("Document Type",SalesLine."Document Type");
              SalesLineSubL.SETRANGE("Document No.",SalesLine."Document No.");
              SalesLineSubL.SETRANGE("Attached to Line No.",SalesLine."Line No.");
              SalesLineSubL.SETFILTER(Type,'>0');
              IF NOT SalesLineSubL.ISEMPTY THEN
                DescriptionTxt :=  STRSUBSTNO(GenSubTxt,SalesLine."Line No.",SalesLine.Type);
            END;
          END;

        END;
        IF SalesLine."Document Type" = SalesLine."Document Type"::Order THEN BEGIN
          ProductionOrderL.SETCURRENTKEY("M365 Sales Order No.","M365 Sales Order Line No.");
          ProductionOrderL.SETRANGE("M365 Sales Order No.",SalesLine."Document No.");
          ProductionOrderL.SETRANGE("M365 Sales Order Line No.",SalesLine."Line No.");
          ProductionOrderL.SETRANGE(Status,ProductionOrderL.Status::Planned,ProductionOrderL.Status::Finished);
          IF NOT ProductionOrderL.ISEMPTY THEN
            DescriptionTxt :=  STRSUBSTNO(ProdOrderTxt,SalesLine."Line No.",SalesLine.Type);
        END;
      END;
      IF LicenseCheck.VGBLicense THEN BEGIN
        VariantBOMHeaderL.SETRANGE("Document Type",SalesLine."Document Type");
        VariantBOMHeaderL.SETRANGE("Document No.",SalesLine."Document No.");
        VariantBOMHeaderL.SETRANGE("Line No.",SalesLine."Line No.");
        VariantBOMHeaderL.SETRANGE(Status,VariantBOMHeaderL.Status::Certified);
        IF NOT VariantBOMHeaderL.ISEMPTY THEN
          DescriptionTxt :=  STRSUBSTNO(VarBOMTxt,SalesLine."Line No.",SalesLine.Type);
      END;
    END;

    PROCEDURE CheckPurchaseLine@5137140(PurchaseLine@5137140 : Record 39;VAR DescriptionTxt@5137141 : Text[250]);
    VAR
      ItemL@5137143 : Record 27;
      PurchaseLineSubL@5137142 : Record 39;
    BEGIN
      IF LicenseCheck.VGALicense THEN BEGIN
        IF PurchaseLine.Type IN[PurchaseLine.Type::Item,PurchaseLine.Type::"Charge (Item)"] THEN BEGIN
          IF PurchaseLine."Attached to Line No." <> 0 THEN
            DescriptionTxt :=  STRSUBSTNO(SubposTxt,PurchaseLine."Line No.",PurchaseLine.Type);

          IF ItemL.GET(PurchaseLine."No.") AND (ItemL."M365 Set" OR ItemL."M365 Generate Subpositions") THEN BEGIN
            IF ItemL."M365 Set" THEN
              DescriptionTxt :=  STRSUBSTNO(SetTxt,PurchaseLine."Line No.",PurchaseLine.Type);
            IF ItemL."M365 Generate Subpositions" THEN BEGIN
              PurchaseLineSubL.SETCURRENTKEY("Document Type","Document No.","Attached to Line No.");
              PurchaseLineSubL.SETRANGE("Document Type",PurchaseLine."Document Type");
              PurchaseLineSubL.SETRANGE("Document No.",PurchaseLine."Document No.");
              PurchaseLineSubL.SETRANGE("Attached to Line No.",PurchaseLine."Line No.");
              PurchaseLineSubL.SETFILTER(Type,'>0');
              IF NOT PurchaseLineSubL.ISEMPTY THEN
                DescriptionTxt :=  STRSUBSTNO(GenSubTxt,PurchaseLine."Line No.",PurchaseLine.Type);
            END;
          END;
        END;

      END;
    END;

    BEGIN
    {
      +--------------------------------------------------------------+
      |           Copyright MODUS Consult AG                         |
      |               MODUS Configurator                             |
      +--------------------------------------------------------------+
      Modul     Date      User      Description
      VGA       17.06.20  TB        Check Sales Lines
    }
    END.
  }
}

OBJECT Codeunit 5130127 MI VAT Rate Change Conversion
{
  OBJECT-PROPERTIES
  {
    Date=25.06.20;
    Time=12:00:00;
    Version List=MI14.00.00.2.VAT;
  }
  PROPERTIES
  {
    OnRun=VAR
            ConvertVATProdPostGrp@5130099 : Boolean;
            ConvertGenProdPostGrp@5130100 : Boolean;
          BEGIN
            VATRateChangeSetup.GET;
            ProgressWindow.OPEN(Text0001 + Text0002);

            // Down Payment
            IF LicenseCheck.MEELicense THEN BEGIN
              IF VATRateChangeSetup."Update Down Payment" = VATRateChangeSetup."Update Down Payment"::"VAT Prod. Posting Group" THEN
                ConvertVATProdPostGrp := TRUE
              ELSE
                ConvertVATProdPostGrp := FALSE;
              ConvertGenProdPostGrp := FALSE;
              UpdatePaymPlanHeader(ConvertVATProdPostGrp,ConvertGenProdPostGrp);
              UpdatePaymPlanLine(ConvertVATProdPostGrp,ConvertGenProdPostGrp);
              UpdatePaymPlanTemplLine(ConvertVATProdPostGrp,ConvertGenProdPostGrp);
              UpdateTable(
                DATABASE::"Payment Plan Template Header",
                ConvertVATProdPostGrp,ConvertGenProdPostGrp);
            END;

            // Engineering Setup
            IF LicenseCheck.MEBLicense THEN BEGIN
              ConvertGenProdPostGrp := FALSE;
              ConvertVATProdPostGrp := TRUE;
              UpdateTable(
                DATABASE::"Engineering Setup",
                ConvertVATProdPostGrp,ConvertGenProdPostGrp);
            END;
            ProgressWindow.CLOSE;
          END;

  }
  CODE
  {
    VAR
      Text0001@5130101 : TextConst 'DEU="Tabelle wird verarbeitet...   #1#####################################  ";ENU="Progressing Table #1#####################################  "';
      Text0002@5130100 : TextConst 'DEU="Datensatz wird verarbeitet... #2############ von #3####################  ";ENU="Progressing Record #2############ of #3####################  "';
      VATRateChangeSetup@5130107 : Record 550;
      VATRateChangeConversion@5130106 : Record 551;
      ProgressWindow@5130104 : Dialog;
      Text0009@5130103 : TextConst 'DEU=Die Konvertierung kann nur ausgefhrt werden, wenn ''%1'' auf ''True'' festgelegt ist.;ENU=Conversion cannot be performed before %1 is set to true.';
      LicenseCheck@5130099 : Codeunit 5130102;
      ShipmentBlockMsg@5130102 : TextConst 'DEU=Bestehende Zeilen mit Lieferblcken mssen manuell bearbeitet werden. Die gelieferten Mengen mssen fakturiert werden und anschlieend die neue MWST Produktbuchungsgruppe in der VK-Zeile eingetragen werden.;ENU=Existing lines with Shipment Blocks must be processed manually. The delivered quantities must be invoiced and then the new VAT product posting group must be entered in the sales order line.';
      FamilyItemMsg@5130105 : TextConst 'DEU=Die Familienzeilen mssen vom Zeilensplit ausgenommen werden;ENU=Familyitem lines have to drop from splitfunction';

    LOCAL PROCEDURE UpdatePaymPlanHeader@8(ConvertVATProdPostGrp@5130101 : Boolean;ConvertGenProdPostGrp@5130100 : Boolean);
    VAR
      PaymPlanHeader@5130099 : Record 5130230;
      RecRef@1001 : RecordRef;
    BEGIN
      ProgressWindow.UPDATE(1,PaymPlanHeader.TABLECAPTION);
      PaymPlanHeader.SETRANGE(Closed,FALSE);
      IF PaymPlanHeader.FIND('-') THEN
        REPEAT
          RecRef.GETTABLE(PaymPlanHeader);
          UpdateRec(RecRef,ConvertVATProdPostGrp,ConvertGenProdPostGrp);
        UNTIL PaymPlanHeader.NEXT = 0;
    END;

    LOCAL PROCEDURE UpdatePaymPlanLine@5130099(ConvertVATProdPostGrp@5130101 : Boolean;ConvertGenProdPostGrp@5130100 : Boolean);
    VAR
      PaymPlanLine@5130099 : Record 5130231;
      RecRef@1001 : RecordRef;
    BEGIN
      ProgressWindow.UPDATE(1,PaymPlanLine.TABLECAPTION);
      PaymPlanLine.SETRANGE("Accounted for",FALSE);
      PaymPlanLine.SETRANGE("Invoice Type",PaymPlanLine."Invoice Type"::"Anticipated Payment Invoice");
      IF PaymPlanLine.FIND('-') THEN
        REPEAT
          RecRef.GETTABLE(PaymPlanLine);
          UpdateRec(RecRef,ConvertVATProdPostGrp,ConvertGenProdPostGrp);
        UNTIL PaymPlanLine.NEXT = 0;
    END;

    LOCAL PROCEDURE UpdatePaymPlanTemplLine@5130103(ConvertVATProdPostGrp@5130101 : Boolean;ConvertGenProdPostGrp@5130100 : Boolean);
    VAR
      PaymPlanTemplLine@5130099 : Record 5130237;
      RecRef@1001 : RecordRef;
    BEGIN
      ProgressWindow.UPDATE(1,PaymPlanTemplLine.TABLECAPTION);
      PaymPlanTemplLine.SETRANGE("Invoice Type",PaymPlanTemplLine."Invoice Type"::"Anticipated Payment Invoice");
      IF PaymPlanTemplLine.FIND('-') THEN
        REPEAT
          RecRef.GETTABLE(PaymPlanTemplLine);
          UpdateRec(RecRef,ConvertVATProdPostGrp,ConvertGenProdPostGrp);
        UNTIL PaymPlanTemplLine.NEXT = 0;
    END;

    LOCAL PROCEDURE UpdateTable@4(TableID@1005 : Integer;ConvertVATProdPostingGroup@1000 : Boolean;ConvertGenProdPostingGroup@1001 : Boolean);
    VAR
      RecRef@1004 : RecordRef;
      I@1003 : Integer;
    BEGIN
      IF NOT ConvertVATProdPostingGroup AND NOT ConvertGenProdPostingGroup THEN
        EXIT;
      RecRef.OPEN(TableID);
      ProgressWindow.UPDATE(1,FORMAT(RecRef.CAPTION));
      I := 0;
      ProgressWindow.UPDATE(3,RecRef.COUNT);
      IF RecRef.FIND('-') THEN
        REPEAT
          I := I + 1;
          ProgressWindow.UPDATE(2,I);
          UpdateRec(RecRef,ConvertVATProdPostingGroup,ConvertGenProdPostingGroup);
        UNTIL RecRef.NEXT = 0;
    END;

    LOCAL PROCEDURE UpdateRec@1(VAR RecRef@1005 : RecordRef;ConvertVATProdPostingGroup@1000 : Boolean;ConvertGenProdPostingGroup@1001 : Boolean);
    VAR
      Field@1008 : Record 2000000041;
      VATRateChangeLogEntry@1002 : Record 552;
      FieldRef@1003 : FieldRef;
      GenProdPostingGroupConverted@1004 : Boolean;
      VATProdPostingGroupConverted@1006 : Boolean;
    BEGIN
      VATRateChangeLogEntry.INIT;
      VATRateChangeLogEntry."Record ID" := RecRef.RECORDID;
      VATRateChangeLogEntry."Table ID" := RecRef.NUMBER;
      Field.SETRANGE(TableNo,RecRef.NUMBER);
      Field.SETFILTER(ObsoleteState,'<>%1',Field.ObsoleteState::Removed);
      Field.SETRANGE(RelationTableNo,DATABASE::"Gen. Product Posting Group");
      IF Field.FIND('+') THEN
        REPEAT
          FieldRef := RecRef.FIELD(Field."No.");
          GenProdPostingGroupConverted := FALSE;
          IF ConvertGenProdPostingGroup THEN
            IF VATRateChangeConversion.GET(VATRateChangeConversion.Type::"Gen. Prod. Posting Group",FieldRef.VALUE) THEN BEGIN
              VATRateChangeLogEntry."Old Gen. Prod. Posting Group" := FieldRef.VALUE;
              FieldRef.VALIDATE(VATRateChangeConversion."To Code");
              VATRateChangeLogEntry."New Gen. Prod. Posting Group" := FieldRef.VALUE;
              GenProdPostingGroupConverted := TRUE;
            END;
          IF NOT GenProdPostingGroupConverted THEN BEGIN
            VATRateChangeLogEntry."Old Gen. Prod. Posting Group" := FieldRef.VALUE;
            VATRateChangeLogEntry."New Gen. Prod. Posting Group" := FieldRef.VALUE;
          END;
        UNTIL Field.NEXT(-1) = 0;

      Field.SETRANGE(RelationTableNo,DATABASE::"VAT Product Posting Group");
      IF Field.FIND('+') THEN
        REPEAT
          FieldRef := RecRef.FIELD(Field."No.");
          VATProdPostingGroupConverted := FALSE;
          IF ConvertVATProdPostingGroup THEN
            IF VATRateChangeConversion.GET(VATRateChangeConversion.Type::"VAT Prod. Posting Group",FieldRef.VALUE) THEN BEGIN
              VATRateChangeLogEntry."Old VAT Prod. Posting Group" := FieldRef.VALUE;
              FieldRef.VALIDATE(VATRateChangeConversion."To Code");
              VATRateChangeLogEntry."New VAT Prod. Posting Group" := FieldRef.VALUE;
              VATProdPostingGroupConverted := TRUE;
            END;
          IF NOT VATProdPostingGroupConverted THEN BEGIN
            VATRateChangeLogEntry."Old VAT Prod. Posting Group" := FieldRef.VALUE;
            VATRateChangeLogEntry."New VAT Prod. Posting Group" := FieldRef.VALUE;
          END;
        UNTIL Field.NEXT(-1) = 0;

      IF VATRateChangeSetup."Perform Conversion" THEN BEGIN
        RecRef.MODIFY;
        VATRateChangeLogEntry.Converted := TRUE;
      END;
      IF (VATRateChangeLogEntry."New Gen. Prod. Posting Group" <> VATRateChangeLogEntry."Old Gen. Prod. Posting Group") OR
         (VATRateChangeLogEntry."New VAT Prod. Posting Group" <> VATRateChangeLogEntry."Old VAT Prod. Posting Group")
      THEN
        WriteLogEntry(VATRateChangeLogEntry);
    END;

    LOCAL PROCEDURE WriteLogEntry@10(VATRateChangeLogEntry@1000 : Record 552);
    BEGIN
      WITH VATRateChangeLogEntry DO BEGIN
        IF Converted THEN
          "Converted Date" := WORKDATE
        ELSE
          IF Description = '' THEN
            Description := STRSUBSTNO(Text0009,VATRateChangeSetup.FIELDCAPTION("Perform Conversion"));
        INSERT;
      END;
    END;

    PROCEDURE CheckSalesLine@5130101(SalesLine@5130099 : Record 37) DescriptTxt : Text[250];
    VAR
      itemL@5130100 : Record 27;
    BEGIN
      // Shipmentblock
      IF LicenseCheck.MEJLicense THEN BEGIN
        IF SalesLine."M365 Shipment Block" <> '' THEN BEGIN
          DescriptTxt := ShipmentBlockMsg;
          EXIT(DescriptTxt);
        END;
      END;

      // Familyitem
      IF LicenseCheck.PMALicense THEN BEGIN
        IF (SalesLine.Type = SalesLine.Type::Item) AND (SalesLine."M365 Family Item Type" <> 0 ) THEN BEGIN
          DescriptTxt := FamilyItemMsg;
          EXIT(DescriptTxt);
        END;
      END;
    END;

    PROCEDURE CopySalesExtTextAndEditor@5130100(FromSalesLine@5130099 : Record 37;ToSalesLine@5130100 : Record 37);
    VAR
      MI_SalesExtendedTextLine@5130101 : Record 5130171;
      MI_EditorMgt@5130102 : Codeunit 5137890;
    BEGIN
      IF LicenseCheck.MEDLicense THEN
        MI_SalesExtendedTextLine.CopyExtLineTexts(
          FromSalesLine."Document Type",ToSalesLine."Document Type",
          FromSalesLine."Document No.",ToSalesLine."Document No.",
          FromSalesLine."Line No.",ToSalesLine."Line No.");

      IF LicenseCheck.METLicense THEN
        MI_EditorMgt.CopyContent(FromSalesLine.RECORDID, ToSalesLine.RECORDID);
    END;

    PROCEDURE CopyPurchExtTextAndEditor@5130102(FromPurchLine@5130099 : Record 39;ToPurchLine@5130100 : Record 39);
    VAR
      MI_PurchExtendedTextLine@5130102 : Record 5130173;
      MI_EditorMgt@5130101 : Codeunit 5137890;
    BEGIN
      IF LicenseCheck.MEDLicense THEN
        MI_PurchExtendedTextLine.CopyExtLineTexts(
          FromPurchLine."Document Type",ToPurchLine."Document Type",
          FromPurchLine."Document No.",ToPurchLine."Document No.",
          FromPurchLine."Line No.",ToPurchLine."Line No.");

      IF LicenseCheck.METLicense THEN
        MI_EditorMgt.CopyContent(FromPurchLine.RECORDID, ToPurchLine.RECORDID);
    END;

    PROCEDURE SaveExistingOrderEntryValues@5130104(oldSalesLine@5130099 : Record 37;VAR existingOrderEntryDate@5130100 : Date;VAR existingOrderEntryTime@5130101 : Time;VAR existingOrderEntryUser@5130102 : Code[50]);
    VAR
      existingOrderEntry@5130103 : Record 5130311;
    BEGIN
      IF NOT LicenseCheck.PMALicense THEN
        EXIT;

      CLEAR(existingOrderEntry);
      CLEAR(existingOrderEntryDate);
      CLEAR(existingOrderEntryTime);
      CLEAR(existingOrderEntryUser);

      IF NOT FilterOrderEntryRecord(oldSalesLine,existingOrderEntry) THEN
        EXIT;

      IF existingOrderEntry.FINDLAST THEN BEGIN
        existingOrderEntryDate := existingOrderEntry.Date;
        existingOrderEntryTime := existingOrderEntry."Entry Time";
        existingOrderEntryUser := existingOrderEntry."User ID";
      END;
    END;

    PROCEDURE UpdateExistingOrderEntriesWithSavedValues@5130107(oldSalesLine@5130099 : Record 37;newSalesLine@5130100 : Record 37;savedDate@5130101 : Date;savedTime@5130102 : Time;savedUser@5130103 : Code[50]);
    VAR
      existingOrderEntry@5130104 : Record 5130311;
    BEGIN
      IF NOT LicenseCheck.PMALicense THEN
        EXIT;

      //1st run for reduced old salesline
      CLEAR(existingOrderEntry);

      IF NOT FilterOrderEntryRecord(oldSalesLine,existingOrderEntry) THEN
        EXIT;

      IF existingOrderEntry.FINDSET(TRUE,FALSE) THEN BEGIN
        REPEAT
          existingOrderEntry.Date := savedDate;
          existingOrderEntry."Entry Time" := savedTime;
          existingOrderEntry."User ID" := savedUser;
          existingOrderEntry.MODIFY();
        UNTIL existingOrderEntry.NEXT() = 0;
      END;

      //2nd run for splitted new SalesLine
      CLEAR(existingOrderEntry);

      IF NOT FilterOrderEntryRecord(newSalesLine,existingOrderEntry) THEN
        EXIT;

      IF existingOrderEntry.FINDSET(TRUE,FALSE) THEN BEGIN
        REPEAT
          existingOrderEntry.Date := savedDate;
          existingOrderEntry."Entry Time" := savedTime;
          existingOrderEntry."User ID" := savedUser;
          existingOrderEntry.MODIFY();
        UNTIL existingOrderEntry.NEXT() = 0;
      END;
    END;

    LOCAL PROCEDURE FilterOrderEntryRecord@5130106(VAR SalesLine@5130099 : Record 37;VAR OrderEntry@5130100 : Record 5130311) : Boolean;
    BEGIN
      WITH SalesLine DO BEGIN
        OrderEntry.SETCURRENTKEY("Order No.", "Order Line No.");
        OrderEntry.SETRANGE("Order No.", "Document No.");
        OrderEntry.SETRANGE("Order Line No.", "Line No.");
        OrderEntry.SETRANGE(Correction, FALSE);
        OrderEntry.SETRANGE("Entry Type", OrderEntry."Entry Type"::Entry);

        IF IsCreditDocType() THEN BEGIN
          OrderEntry.SETRANGE("Entry Type", OrderEntry."Entry Type"::"Credit Memo");
        END;

        EXIT(NOT OrderEntry.ISEMPTY());
      END;
    END;

    BEGIN
    {
      +--------------------------------------------------------------+
      |                  Copyright MODUS Consult AG                  |
      |                        Engineering                           |
      +--------------------------------------------------------------+
      Module    Date      User     Reference  Description
      MI.VAT    15.06.20  BS                  created
      MI.VAT    25.06.20  AB                  fix Exit-Conditions in CheckSalesLine
    }
    END.
  }
}

OBJECT Page 550 VAT Rate Change Setup
{
  OBJECT-PROPERTIES
  {
    Date=18.06.20;
    Time=12:00:00;
    Version List=NAVW113.00,MI14.00.00.2.VAT;
  }
  PROPERTIES
  {
    CaptionML=[DEU=Einrichtung der MwSt.-Satznderung;
               ENU=VAT Rate Change Setup];
    ApplicationArea=#Basic,#Suite;
    InsertAllowed=No;
    DeleteAllowed=No;
    SourceTable=Table550;
    PageType=Card;
    UsageCategory=Administration;
    OnOpenPage=BEGIN
                 RESET;
                 IF NOT GET THEN BEGIN
                   INIT;
                   INSERT;
                 END;
               END;

    ActionList=ACTIONS
    {
      { 18      ;    ;ActionContainer;
                      ActionContainerType=ActionItems }
      { 3       ;1   ;ActionGroup;
                      CaptionML=[DEU=&Einrichtung;
                                 ENU=S&etup];
                      Image=Setup }
      { 21      ;2   ;Action    ;
                      CaptionML=[DEU=Konvertierung fr MwSt.-Produktbuchungsgruppe;
                                 ENU=VAT Prod. Posting Group Conv.];
                      ToolTipML=[DEU=MwSt.-Produktbuchungsgruppen fr die Konvertierung des MwSt.-Satzes anzeigen oder bearbeiten. Die MwSt.-Produktbuchungsgruppencodes bestimmen die Berechnung und Buchung der MwSt. gem des Typs der erworbenen bzw. verkauften Artikel oder Ressourcen. Fr jede MwSt.-Produktbuchungsgruppenkonvertierung enthlt das Fenster eine Zeile, in der Sie angeben, ob die aktuelle Buchungsgruppe durch die neue Buchungsgruppe aktualisiert wird.;
                                 ENU=View or edit the VAT product posting groups for VAT rate change conversion. The VAT product group codes determine calculation and posting of VAT according to the type of item or resource being purchased or the type of item or resource being sold. For each VAT product posting group conversion, the window contains a line where you specify if the current posting group will be updated by the new posting group.];
                      ApplicationArea=#Basic,#Suite;
                      RunObject=Page 551;
                      Promoted=Yes;
                      PromotedIsBig=Yes;
                      Image=Registered;
                      PromotedCategory=Process }
      { 22      ;2   ;Action    ;
                      CaptionML=[DEU=Konvertierung fr Produktbuchungsgruppe;
                                 ENU=Gen. Prod. Posting Group Conv.];
                      ToolTipML=[DEU=Geschftsbuchungs- und Produktbuchungsgruppen fr die Konvertierung des MwSt.-Satzes anzeigen oder bearbeiten. Die Geschftsbuchungs- und Produktbuchungsgruppencodes bestimmen die Buchung gem der erworbenen bzw. verkauften Artikel oder Ressourcen. Fr jede Geschftsbuchungs- und Produktbuchungsgruppenkonvertierung enthlt das Fenster eine Zeile, in der Sie angeben, ob die aktuelle Buchungsgruppe durch die neue Buchungsgruppe aktualisiert wird.;
                                 ENU=View or edit the general product posting groups for VAT rate change conversion. The general product posting group codes determine posting according to the type of item and resource being purchased or sold. For each general product posting group conversion, the window contains a line where you specify the current posting group that will be updated by the new posting group.];
                      ApplicationArea=#Suite;
                      RunObject=Page 552;
                      Promoted=Yes;
                      PromotedIsBig=Yes;
                      Image=GeneralPostingSetup;
                      PromotedCategory=Process }
      { 39      ;1   ;ActionGroup;
                      CaptionML=[DEU=F&unktion;
                                 ENU=F&unction];
                      Image=Action }
      { 34      ;2   ;Action    ;
                      CaptionML=[DEU=&Konvertieren;
                                 ENU=&Convert];
                      ToolTipML=[DEU=Konvertiert den ausgewhlten MwSt.-Satz.;
                                 ENU=Convert the selected VAT rate.];
                      ApplicationArea=#Basic,#Suite;
                      RunObject=Codeunit 550;
                      Promoted=Yes;
                      PromotedIsBig=Yes;
                      Image=PostOrder;
                      PromotedCategory=Process }
      { 19      ;1   ;ActionGroup;
                      CaptionML=[DEU=Historie;
                                 ENU=History];
                      Image=History }
      { 26      ;2   ;Action    ;
                      CaptionML=[DEU=Protokollposten fr MwSt.-Satz-nderung;
                                 ENU=VAT Rate Change Log Entries];
                      ToolTipML=[DEU=Die Geschftsbuchungs- und Produktbuchungsgruppencodes bestimmen die Buchung gem der erworbenen bzw. verkauften Artikel oder Ressourcen. Fr jede Geschftsbuchungs- und Produktbuchungsgruppenkonvertierung enthlt das Fenster eine Zeile, in der Sie angeben, ob die aktuelle Buchungsgruppe durch die neue Buchungsgruppe aktualisiert wird.;
                                 ENU=The general product posting group codes determine posting according to the type of item and resource being purchased or sold. For each general product posting group conversion, the window contains a line where you specify the current posting group that will be updated by the new posting group.];
                      ApplicationArea=#Basic,#Suite;
                      RunObject=Page 553;
                      Promoted=Yes;
                      PromotedIsBig=Yes;
                      Image=ChangeLog;
                      PromotedCategory=Process }
    }
  }
  CONTROLS
  {
    { 1   ;0   ;Container ;
                ContainerType=ContentArea }

    { 2   ;1   ;Group     ;
                CaptionML=[DEU=Allgemein;
                           ENU=General];
                GroupType=Group }

    { 4   ;2   ;Field     ;
                ToolTipML=[DEU=Gibt an, ob die Konvertierung des MwSt.-Satzes abgeschlossen ist.;
                           ENU=Specifies if the VAT rate change conversion is complete.];
                ApplicationArea=#Basic,#Suite;
                SourceExpr="VAT Rate Change Tool Completed" }

    { 5   ;2   ;Field     ;
                ToolTipML=[DEU=Gibt an, dass die Konvertierung des MwSt.-Satzes fr vorhandene Daten ausgefhrt wird.;
                           ENU=Specifies that the VAT rate conversion is performed on existing data.];
                ApplicationArea=#Basic,#Suite;
                SourceExpr="Perform Conversion" }

    { 9   ;1   ;Group     ;
                CaptionML=[DEU=Masterdaten;
                           ENU=Master Data];
                GroupType=Group }

    { 10  ;2   ;Field     ;
                ToolTipML=[DEU=Legt die nderung des MwSt.-Satzes fr Sachkonten fest.;
                           ENU=Specifies the VAT rate change for general ledger accounts.];
                ApplicationArea=#Basic,#Suite;
                SourceExpr="Update G/L Accounts" }

    { 40  ;2   ;Field     ;
                ToolTipML=[DEU=Legt durch Setzen entsprechender Filter fest, welche Konten aktualisiert werden.;
                           ENU=Specifies which accounts will be updated by setting appropriate filters.];
                ApplicationArea=#Basic,#Suite;
                SourceExpr="Account Filter";
                OnLookup=BEGIN
                           EXIT(LookUpGLAccountFilter(Text));
                         END;
                          }

    { 11  ;2   ;Field     ;
                ToolTipML=[DEU=Legt die nderung des MwSt.-Satzes fr Artikel fest.;
                           ENU=Specifies the VAT rate change for items.];
                ApplicationArea=#Basic,#Suite;
                SourceExpr="Update Items" }

    { 45  ;2   ;Field     ;
                ToolTipML=[DEU=Legt durch Setzen entsprechender Filter fest, welche Artikel aktualisiert werden.;
                           ENU=Specifies which items will be updated by setting appropriate filters.];
                ApplicationArea=#Basic,#Suite;
                SourceExpr="Item Filter";
                OnLookup=BEGIN
                           EXIT(LookUpItemFilter(Text));
                         END;
                          }

    { 14  ;2   ;Field     ;
                ToolTipML=[DEU=Legt die nderung des MwSt.-Satzes fr Ressourcen fest.;
                           ENU=Specifies the VAT rate change for resources.];
                ApplicationArea=#Basic,#Suite;
                SourceExpr="Update Resources" }

    { 46  ;2   ;Field     ;
                ToolTipML=[DEU=Legt durch Setzen entsprechender Filter fest, welche Ressourcen aktualisiert werden.;
                           ENU=Specifies which resources will be updated by setting appropriate filters.];
                ApplicationArea=#Basic,#Suite;
                SourceExpr="Resource Filter";
                OnLookup=BEGIN
                           EXIT(LookUpResourceFilter(Text));
                         END;
                          }

    { 13  ;2   ;Field     ;
                ToolTipML=[DEU=Gibt an, dass die nderungen des MwSt.-Satzes fr Artikelkategorien aktualisiert werden.;
                           ENU=Specifies that VAT rate changes are updated for item categories.];
                ApplicationArea=#Basic,#Suite;
                SourceExpr="Update Item Templates" }

    { 12  ;2   ;Field     ;
                ToolTipML=[DEU=Legt die nderung des MwSt.-Satzes fr Artikelzuschlge/-abschlge fest.;
                           ENU=Specifies the VAT rate change for item charges.];
                ApplicationArea=#ItemCharges;
                SourceExpr="Update Item Charges" }

    { 17  ;2   ;Field     ;
                ToolTipML=[DEU=Legt die nderung des MwSt.-Satzes fr Geschftsbuchungs- und Produktbuchungsgruppen fest.;
                           ENU=Specifies the VAT rate change for general product posting groups.];
                ApplicationArea=#Suite;
                SourceExpr="Update Gen. Prod. Post. Groups" }

    { 23  ;2   ;Field     ;
                ToolTipML=[DEU=Legt die nderung des MwSt.-Satzes fr Servicepreiskorrekturdetails fest.;
                           ENU=Specifies the VAT rate change for service price adjustment detail.];
                ApplicationArea=#Service;
                SourceExpr="Update Serv. Price Adj. Detail" }

    { 24  ;2   ;Field     ;
                ToolTipML=[DEU=Legt die nderung des MwSt.-Satzes fr Arbeitsgruppen fest.;
                           ENU=Specifies the VAT rate change for work centers.];
                ApplicationArea=#Manufacturing;
                SourceExpr="Update Work Centers" }

    { 25  ;2   ;Field     ;
                ToolTipML=[DEU=Legt die nderung des MwSt.-Satzes fr Arbeitspltze fest.;
                           ENU=Specifies the VAT rate change for machine centers.];
                ApplicationArea=#Manufacturing;
                SourceExpr="Update Machine Centers" }

    { 37  ;1   ;Group     ;
                CaptionML=[DEU=Buch.-Bltter;
                           ENU=Journals];
                GroupType=Group }

    { 44  ;2   ;Field     ;
                ToolTipML=[DEU=Legt die nderung des MwSt.-Satzes fr Buch.-Blattzeilen fest.;
                           ENU=Specifies the VAT rate change for general journal lines.];
                ApplicationArea=#Basic,#Suite;
                SourceExpr="Update Gen. Journal Lines" }

    { 43  ;2   ;Field     ;
                ToolTipML=[DEU=Legt die nderung des MwSt.-Satzes fr die Buch.-Blattverteilung fest.;
                           ENU=Specifies the VAT rate change for general journal allocation.];
                ApplicationArea=#Basic,#Suite;
                SourceExpr="Update Gen. Journal Allocation" }

    { 42  ;2   ;Field     ;
                ToolTipML=[DEU=Legt die nderung des MwSt.-Satzes fr standardmige Buch.-Blattzeilen fest.;
                           ENU=Specifies the VAT rate change for standard general journal lines.];
                ApplicationArea=#Basic,#Suite;
                SourceExpr="Update Std. Gen. Jnl. Lines" }

    { 41  ;2   ;Field     ;
                ToolTipML=[DEU=Legt die nderung des MwSt.-Satzes fr Ressourcen Buch.-Blattzeilen fest.;
                           ENU=Specifies the VAT rate change for resource journal lines.];
                ApplicationArea=#Basic,#Suite;
                SourceExpr="Update Res. Journal Lines" }

    { 38  ;2   ;Field     ;
                ToolTipML=[DEU=Legt die nderung des MwSt.-Satzes fr Projekt Buch.-Blattzeilen fest.;
                           ENU=Specifies the VAT rate change for job journal lines.];
                ApplicationArea=#Jobs;
                SourceExpr="Update Job Journal Lines" }

    { 16  ;2   ;Field     ;
                ToolTipML=[DEU=Legt die nderung des MwSt.-Satzes fr Bestellvorschlagszeilen fest.;
                           ENU=Specifies the VAT rate change for requisition lines.];
                ApplicationArea=#Basic,#Suite;
                SourceExpr="Update Requisition Lines" }

    { 15  ;2   ;Field     ;
                ToolTipML=[DEU=Legt die nderung des MwSt.-Satzes fr standardmige Artikel Buch.-Blattzeilen fest.;
                           ENU=Specifies the VAT rate change for standard item journal lines.];
                ApplicationArea=#Basic,#Suite;
                SourceExpr="Update Std. Item Jnl. Lines" }

    { 27  ;1   ;Group     ;
                CaptionML=[DEU=Belege;
                           ENU=Documents];
                GroupType=Group }

    { 28  ;2   ;Field     ;
                ToolTipML=[DEU=Legt die nderung des MwSt.-Satzes fr Verkaufsbelege fest.;
                           ENU=Specifies the VAT rate change for sales documents.];
                ApplicationArea=#Basic,#Suite;
                SourceExpr="Update Sales Documents" }

    { 8   ;2   ;Field     ;
                ToolTipML=[DEU=Gibt an, dass alle vorhandenen Verkaufsbelege unabhngig vom Status, einschlielich Belegen, mit verffentlichtem Status aktualisiert werden.;
                           ENU=Specifies that all existing sales documents regardless of status, including documents with a status of released, are updated.];
                ApplicationArea=#Basic,#Suite;
                SourceExpr="Ignore Status on Sales Docs." }

    { 29  ;2   ;Field     ;
                ToolTipML=[DEU=Legt die nderung des MwSt.-Satzes fr Einkaufsbelege fest.;
                           ENU=Specifies the VAT rate change for purchase documents.];
                ApplicationArea=#Basic,#Suite;
                SourceExpr="Update Purchase Documents" }

    { 33  ;2   ;Field     ;
                ToolTipML=[DEU=Gibt an, das alle vorhandenen Einkaufsbelege unabhngig vom Status, einschlielich Belegen, mit verffentlichtem Status aktualisiert werden;
                           ENU=Specifies all existing purchase documents regardless of status, including documents with a status of released, are updated.];
                ApplicationArea=#Basic,#Suite;
                SourceExpr="Ignore Status on Purch. Docs." }

    { 20  ;2   ;Field     ;
                ToolTipML=[DEU=Legt die nderung des MwSt.-Satzes fr Servicezeilen fest.;
                           ENU=Specifies the VAT rate change for service lines.];
                ApplicationArea=#Service;
                SourceExpr="Update Service Docs." }

    { 6   ;2   ;Field     ;
                ToolTipML=[DEU=Gibt an, dass alle vorhandenen Servicebelege unabhngig vom Versionsstatus aktualisiert werden.;
                           ENU=Specifies that all existing service documents regardless of release status are updated.];
                ApplicationArea=#Service;
                SourceExpr="Ignore Status on Service Docs." }

    { 30  ;2   ;Field     ;
                ToolTipML=[DEU=Legt die nderung des MwSt.-Satzes fr Fertigungsauftrge fest.;
                           ENU=Specifies the VAT rate change for production orders.];
                ApplicationArea=#Manufacturing;
                SourceExpr="Update Production Orders" }

    { 31  ;2   ;Field     ;
                ToolTipML=[DEU=Legt die nderung des MwSt.-Satzes fr Mahnungen fest.;
                           ENU=Specifies the VAT rate change for reminders.];
                ApplicationArea=#Suite;
                SourceExpr="Update Reminders" }

    { 32  ;2   ;Field     ;
                ToolTipML=[DEU=Legt die nderung des MwSt.-Satzes fr Zinsrechnungen fest.;
                           ENU=Specifies the VAT rate change for finance charge memos.];
                ApplicationArea=#Suite;
                SourceExpr="Update Finance Charge Memos" }

    { 5130100;1;Group     ;
                CaptionML=[DEU=MODUS Industry;
                           ENU=MODUS Industry];
                GroupType=Group }

    { 5130099;2;Field     ;
                SourceExpr="Update Down Payment" }

  }
  CODE
  {

    BEGIN
    {
      +--------------------------------------------------------------+
      |                  Copyright MODUS Consult AG                  |
      |                        Engineering                           |
      +--------------------------------------------------------------+
      Module    Date      User     Reference  Description
      MI.VAT    15.06.20  BS                  New Field 5130220 Update Down Payment
    }
    END.
  }
}

